The following is the datbound syntax used to update two text boxes on a form, they are connected to a dbcombo box with a list of zipcodes when the user selects the zipcode the city and state are automatically suppose to update well the do only after the user selects the zipcode and it get placed in the top window then if you double click next to it, It update the other fields. I tried changing this to a single click event and get and error on the txtcity.text line
Private Sub dbcZipcode_dblclick(Area As Integer)
Dim sqlstring As String
'Puts the selected ZIP, State and City into their respective boxes, moves the focus to
Dim sql As String
sql = datZipcode.RecordSource
'Get data from table
sqlstring = dbcZipcode.Text
sql = "SELECT * FROM zipcode Where Zipcode = '" + sqlstring + "' "
datZipcode.RecordSource = sql
datZipcode.Refresh
'populated associated fields, if match
txtCity.Text = datZipcode.Recordset("city"
txtState.Text = datZipcode.Recordset.Fields("State"
'reset data control
sql = "SELECT * FROM zipcode "
datZipcode.RecordSource = sql
datZipcode.Refresh
End Sub
Private Sub dbcZipcode_dblclick(Area As Integer)
Dim sqlstring As String
'Puts the selected ZIP, State and City into their respective boxes, moves the focus to
Dim sql As String
sql = datZipcode.RecordSource
'Get data from table
sqlstring = dbcZipcode.Text
sql = "SELECT * FROM zipcode Where Zipcode = '" + sqlstring + "' "
datZipcode.RecordSource = sql
datZipcode.Refresh
'populated associated fields, if match
txtCity.Text = datZipcode.Recordset("city"
txtState.Text = datZipcode.Recordset.Fields("State"
'reset data control
sql = "SELECT * FROM zipcode "
datZipcode.RecordSource = sql
datZipcode.Refresh
End Sub