Brand new to VB 2008 Express, but have done some work in VB 6. Not sure what I'm missing, but here goes. I have two comboboxes linked to an Access 2007 database. One box lists the names of the States in the US. This is what I used for the Table Adapter Configuration Wizard for the combobox "State"
SELECT ST_UID, ST_NAME FROM STATE
For the combobox County I used:
SELECT ST_UID, CTY_NAME FROM COUNTY
ST_UID is an Integer. I created a label with a bound value to STATE.ST_UID so that when a user selects the name of a state from the State box the appropriate ST_UID populates the label, (i.e, California has an ST_UID = 5). The problem is when a state is selected, I only want the Counties for that state to appear in the County box, i.e, COUNTY.ST_UID = 5 if California is the selected state.
I then tried to convert the value in the st_uid label to an integer:
Dim strState As String
Dim StUID As Integer
strState = Val(lblStateName.Text.ToString)
StUID = strState
This is what I last tried when again using the Table Adapter Configuration Wizard for the table that populates the County box:
SELECT ST_UID, CNTY_NAME FROM COUNTY Where ST_UID = 'StUID' Order By st_uid, cnty_name
What I'm getting is a "Data type mismatch in criteria expression."
I'm sure my error is something so simple I'll kick myself when I get this solved, but as I said I'm a beginner so any advice is most appreciated!