Solved Linking two fields on a form (1 Viewer)

jjgolob

New member
Local time
Yesterday, 17:03
Joined
Aug 19, 2021
Messages
18
I have form that has a Customer field which is a combo box. Further down the form, I have Combo box named Coding String. This form is used to fill a table, Trip Tickets. The Customer field is pulled from a list created by the Vendor List table. The Row Source coding is SELECT [Vendor List].[Vendor] FROM [Vendor List] ORDER BY [Vendor]; I have a Coding String table which contains both the Customer Name and the Coding String associated with it. It some cases, there will be multiple Coding Strings attached to a single customer.

What I would like to do is to have the form pull the Customer name from the form once it has been selected and use that to limit the available Coding Strings. I want only the Coding Strings attached to that particular Customer available in a Combo Box.

How do I accomplish this. I have tried several different things, but just can't seem to link the two items together.

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:03
Joined
Oct 29, 2018
Messages
17,113
Hi. Do a search on on "cascading combobox." Sorry, I don't have time to show it to you right now. Good luck!
 

jjgolob

New member
Local time
Yesterday, 17:03
Joined
Aug 19, 2021
Messages
18
Ok Thanks
 

CJ_London

Super Moderator
Staff member
Local time
Today, 00:03
Joined
Feb 19, 2013
Messages
13,542
better to avoid spaces in field and control names - can cause issues. If your control has code, vba will substitute a space with an underline character - or perhaps surround with square brackets. But to answer your question

for your other combo's has a rowsource along the lines of

SELECT PK, somefield FROM sometable WHERE vendorFK=[CodingString]

and in the after update event of your coding string control, requery all the dependant combos and reset to null

dependantcombo1.requery
dependantcombo1=null
etc

But from your brief description, it looks like you have other problems - your vendor list would appear not to have a primary key. It should have and should be returned in your coding string rowsource and used. Using (presumably) a vendor name is not the right way to go.
 

jjgolob

New member
Local time
Yesterday, 17:03
Joined
Aug 19, 2021
Messages
18
I searched up cascading combo boxes and it did exactly what I needed. It took a bit to make them work right, but in the end, perfect. Thanks theDBGuy!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 16:03
Joined
Oct 29, 2018
Messages
17,113
I searched up cascading combo boxes and it did exactly what I needed. It took a bit to make them work right, but in the end, perfect. Thanks theDBGuy!
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom