Bound2needhelp
Jan 25 2006, 12:02 PM
I am using a form to allow users to dynamically set criteria for a report. I have a combobox that displays a field list from the tblMasterFacilityTable. I need the 2nd combobox to be populated with the values from the field chosen i.e. Values from the TxtFacilityType field should be H,CAH,SpH,VA,IHS. I can't seem to get the second combobox to work. I have tried to use a query and also code but I'm lost :-(
Larry Larsen
Jan 25 2006, 12:23 PM
Hi
Welcome to Utter Access Forums
What you need is some help in creating what's called "cascading combos" where one combo is driven by another..
Here is a link that will give you some assistance:
How can I filter one Microsoft Access combobox based on another combobox selection?.
One of the more common mistakes made is not giving the second combo a
Requery after the selection is made from the first combo..
Bound2needhelp
Jan 25 2006, 01:06 PM
I've had good luck doing the cascading combo boxes before. I may be making this harder than it should be let me go further;
I am having trouble getting the select statement to work because the "field name" value can change each time. Here's what I have
Dim x As String
Dim strSql As String
' I am using the this line because txtText10 is a combox box that displays a field list from the
tbleMaster_facility_table
x = Me.Text10
strSql = "select " & x & " from tbleMaster_facility_table"
txTtext20.rowsource=strSql
txtText20.requery
Unforunately I am not getting anything
Bound2needhelp
Jan 25 2006, 01:10 PM
I forgot to mention that when I look at the properties on the form anfter I make a change in the first combo box the rowsource reads leterally "select [the correct field name] from tbleMaster_facility_table" (without the quotes) but the combo box remains empty ????
Bound2needhelp
Jan 25 2006, 01:21 PM
If only I would learn to spell things corectly :-)
Thanks for your reply and it works. I even got it to limit the list to distinct values.
I love this forum
Larry Larsen
Jan 25 2006, 01:40 PM
Hi
You're welcome..
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.