Value in a Combo Box as a Variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I take the value from a Combo Box and turn it into a variable so I can
update a table in a SQL database?
 
Concatenate its value into an SQL string that you build in code.

or

Write a public function that reads the value in the combo box and returns it
as the value of the function; call this function from a query (assumes that
you're running the query in the ACCESS front end).
 
For numeric fields:
strSQL = "SELECT * FROM MyTable WHERE [FieldName]=" & Me.ComboboxName.Value


For text fields:
strSQL = "SELECT * FROM MyTable WHERE [FieldName]='" & Me.ComboboxName.Value
& "'"

--

Ken Snell
<MS ACCESS MVP>
 
Back
Top