Link a combo box with update query

S

Sapper

Let me start by saying I am brand new to access, I have taken a introduction
to database class. I made a unbound combo box and typed in a list of update
queries that I have. How can I link them to one command button after a
selection is made? Or can this even be done? Please try and keep it simple,
I know next to nothing about writing code. Thanks for any help I can get.
 
C

Carl Rapson

In the Click event of the command button, run the query that is currently
selected in the combo box:

Private Sub cmdButton_Click()
' If a query is selected
If cboQueries.ListIndex > -1 Then
' Execute the query
DoCmd.RunSQL cboQueries
End If
End Sub

Be sure to use your own control names in place of the ones I've made up.

Carl Rapson
 
Top