Beginner here with VB 2008 Express.
Thanks to this forum, I have one problem solved, properly converting text to numbers. Now I want to use that conversion as a selection parameter in a FillBy statement. Here's what I'm trying to do:
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, CNTY_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.
Apparently the following code converts the value in the st_uid label to an Integer:
Dim StUID As Integer
StUID = CInt(Trim(lblStUID.Text))
This is what I last tried when again using the Table Adapter Configuration Wizard for the table that populates the County box:
SELECT CNTY_FIPS_CD, CNTY_NAME, CNTY_UID, ST_UID
WHERE (ST_UID = '" & StUID & "')
ORDER BY ST_UID, CNTY_NAME
Problem is I'm not getting any results, the "County" combobox is blank. I've tried a lot of variations on the code, such as % StUID %, etc., but no luck. I have experience with VB 6 but am a beginner with .NET. All suggestions most appreciated!
Edited 6 Years Ago by Aleksandor51: Typos