Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking combo boxes 2

Status
Not open for further replies.

PrintNET

MIS
Sep 30, 2002
30
US
I want to make it so that when the user selects an item in one box, which displays all items in a certain column, the other box would automatically change to another item in a set column on the same row. Any tips on how to do this?
 
PrintNET, I got it working. Here is what I did:

Here is the record source for cbo1: SELECT [Sheet1 Query].[SKU] FROM [Sheet1 Query] GROUP BY [Sheet1 Query].[SKU];

Here is the record source for cbo2: SELECT [Sheet1 Query].[Description], [Sheet1 Query].[SKU] FROM [Sheet1 Query] WHERE ((([Sheet1 Query].[SKU])=[Forms]![frmMyForm]!cbo1));

Requery cbo2 by placing the following in the <AfterUpdate> event of cbo1: Me.cbo2.Requery

HTH!


Attitudes are contagious
 
PrintNET, I got it working. Here is what I did:

Here is the record source for cbo1: SELECT [Sheet1 Query].[SKU] FROM [Sheet1 Query] GROUP BY [Sheet1 Query].[SKU];

Here is the record source for cbo2: SELECT [Sheet1 Query].[Description], [Sheet1 Query].[SKU] FROM [Sheet1 Query] WHERE ((([Sheet1 Query].[SKU])=[Forms]![frmMyForm]!cbo1));

Requery cbo2 by placing the following in the <AfterUpdate> event of cbo1: Me.cbo2.Requery

HTH!
 
When do that it says &quot;Microsoft Access cannot find the macro 'Me.'
 
Well, i will say that I had some luck with it. But i end up with some options in the combo that either shouldn't be there and are, or some options that should be there and arent. So that could just be a problem with my coding. Otherwise it works for me. And if it doesnt work for you PrintNet, i suggest you give us the code for your rowsources, cause that seems like the main problem for me.
 
It means Access is not sure what the object's exact name is. As an alternative, you could type: Forms!frmMyForm!cbo2.Requery.

HTH!

Attitudes are contagious
 
no i get the &quot;Microsoft Access cannot find the macro 'Me.'&quot; error. I don't know what is wrong. (other than the fact that it can't find the 'Me' macro ;) )
 
At what point are you receiving the error?

Attitudes are contagious
 
ugh, now it says that Access can't find the macro 'Forms!frmMyForm!cbo2.'
 
it says it when i select something in the first combo box, and my 2 last posts are supposed to be before both of your posts that precede them
 
Are you remembering to type 'Forms!frmMyForm!cbo2.Requery' ? because you didnt type it and i was just checking to see maybe that would make a difference, yet you might already have it typed, but it just didnt find an error with that section of the code. Just checkin!

Ryan
 
I'm sorry, i meant that you didnt type &quot;Requery&quot; in your previous question. because you did type the phrase, you just left out Requery.

And some things, that should not have been forgotten, have been lost.
 
yeah .Requery is in there, just not in the error message
 
If I change it to just cbo2.Requery there is no error but cbo2 remains blank when cbo1 is changed.
 
and you are sure you cant use me. or me! ?


And some things, that should not have been forgotten, were lost.
 
both Me!cbo2.Requery and Me.cbo2.Requery don't give errors and yet still leave cbo2 blank after cbo1 is updated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top