Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 27th, 2005, 10:01 PM
Jessica Jessica is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 19 m 2 sec
Reputation Power: 0
Question matching problem

hi,

i got a problem here.

i have 2 combo box,
cbo1 contains a, b ,c
cbo2 contains 1, 2, 3

when i choose a, i want the cbo2 display 1 automatically, what should i do?

help me plz .....
thanks...

Reply With Quote
  #2  
Old January 28th, 2005, 12:31 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
I have this strange feeling there is a lot more to this question than what you posted, so I will give you the direct answer and then you can post back with your follow-up questions:

In the AfterUpDate event

If cbo1 = "a" Then
cbo2 = 1
End If

lwells

Reply With Quote
  #3  
Old January 28th, 2005, 12:57 AM
Jessica Jessica is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 19 m 2 sec
Reputation Power: 0
Iwells,
thank you for your reply.sorry, let me giv an example here
i got a table with empID and product
empID n product is the one which is assigned into those combo boxes that i mentioned.
if i choose the empID in lets say cbo1, cbo2 (product) i wan it to display the data automatically.
i do not want to assign the value 1 to 1 ( like a = 1), what i want is an overall code, which can apply to many empIDs n products ...
hope u understand what i mean ..
thanks

Jessica

Reply With Quote
  #4  
Old January 28th, 2005, 07:20 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Jessica,

What it sounds like you are wanting to do, is when you display each empID in cbo1, you want to requery or change the list of available Products in cbo2 that will relate or match to empID.

In the properties for cbo2, create a query for the recordsource and add the empID from cbo1 to the criteria for the cbo2 empID. Something like [Forms]![NameOfForm]![cbo1] The empID would have to be the bound column in cbo1 in this example.

Then in the AfterUpdate event for cbo1 just add this code to requery the list in cbo2:

Me.Refresh

Now when you select an empID in cbo1, cbo2 will change the list of available products that match to the empID.

Was this what you were looking for?
lwells

Reply With Quote
  #5  
Old January 30th, 2005, 03:43 AM
Jessica Jessica is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 19 m 2 sec
Reputation Power: 0
hi Iswell,

sorry but i cant get what i suppose to get.. the cbo2 jz came out blank..

i have another question: how to match a value (enter by user) with data from a table?
for example,
user enter product code, then the machine will match the product code for product name = ABC(the data already in the table) , then go to a form
(what i mean is an overall command .. not for a product name only)

Thanks

Jessica

Reply With Quote
  #6  
Old January 30th, 2005, 10:05 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Jessica,

How did you set up your rowsource for the cbo2? Try posting the sql so I can see how you have it set up.

For you second question, just include the criteria in your open form command. Assuming that the product code and the product name are in the same record and you are opening a form from a command button:

Dim stDocName As String
Dim strTemp As String

stDocName = "Your Form Name Here"
strTemp = "What the User typed In"

DoCmd.OpenForm stDocName, , , "[Product Code] = '" & strTemp & "'"

Use the wizard to help build the code and then go in and modify slightly for your use.

lwells

Reply With Quote
  #7  
Old January 30th, 2005, 07:25 PM
Jessica Jessica is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 19 m 2 sec
Reputation Power: 0
hi Iwells,

here is the row source sql:

SELECT tblUsers.ProName
FROM tblUsers
WHERE (((tblUsers.ProName)=[forms]![pro]![cboUser]));


for the coding that you have wrote for me, it works. i wonder if there is any way to do an action of open for with 2 conditions?
eg : i enter product code and employee ID, then if it is in category A, it will go to form 1, if it is in category B it will go to form 2 .. and so on ...

Thanks.
Regards,
Jessica

Reply With Quote
  #8  
Old January 30th, 2005, 08:05 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Jessica,

The row source looks okay, did you refresh the form after you updated the cbo1?

Your second question, using two criterias will work similar. Because you are going to use an If condition depending on the category, then I would probably look at using a DLookup to determine which category it is and then open the appropriate form.

Dim stCat As String
Dim stDocName As String
Dim stID As String, strTemp As String

strCat = DLookUp("[Category]","NameOfTable","[employeeID] = " & stID And "[ProductCode] = '" & strTemp & "'")

If strCat = "A" Then
stDocName = Form1
DoCmd.OpenForm stDocName
ElseIf strCat = "B" Then
stDocName = Form2
DoCmd.OpenForm stDocName
End If

There are varieties of ways of doing this including a Select Case which would be faster if you had lots of different forms to open. With just two selections it won't matter.

lwells

Reply With Quote
  #9  
Old January 30th, 2005, 09:18 PM
Jessica Jessica is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 9 Jessica User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 19 m 2 sec
Reputation Power: 0
hi Iwells,

i did put "me.refresh" in AfterUpdate for cbo1 then i put the sql statement in the raw source of cbo2, was my step done wrongly?

the DlookUp returns empty value for strCat, what problem could it be?
it returns run time error '13' . Type Missmatch.
i change the stID and strTemp in the DlookUp to ".value" , which will take the value directly from what user will key in, is it the where the problem is?
Do i need to add a 'Category' column in my table as well?


Thanks.
Regards,
Jessica

Reply With Quote
  #10  
Old January 31st, 2005, 01:05 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Hi Jessica,

Send me a copy of your database and let me see what you are doing and the table structure. When you mentioned category, I was assuming that was in your table. I know that it is sometimes difficult to explain what you are wanting to do and still have it make sense, so maybe if I see what you are doing it will be alot clearer to me. By the way, where is category if not in a table someplace...how are you going to distinguish which records go with form1 and which records go with form2?

Send the database to lwells1433@aol.com and let me review it. You can leave out anything that is confidential, I can make bogus records based on data types for testing.

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > matching problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT