Need Help on how to use combo boxes as a query (1 Viewer)

gmann

Registered User.
Local time
Today, 11:02
Joined
Jun 24, 2002
Messages
21
Can anyone give me an idea how to use combo boxes as a query.

I know some SQL, but i'm confused on how you reference the value in the combo box and how to correlate that with the Table being queryed

Should this be AfterUpdate

Private Sub Combo10_BeforeUpdate(Cancel As Integer)
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set rst = dbs.OpenRecordset("LAB2", dbOpenDynaset, dbConsistent)

'Then What?
End Sub

Thanks Greg

Sorry for so many questions.
 

Alexandre

Registered User.
Local time
Today, 17:02
Joined
Feb 22, 2001
Messages
794
Let's look at a simple example.
The control you take your parameter from is TxtValue
The query you want to launch is called qryName, taking its values from TblName based on the values in the field CriteriaField. You've created it through the query grid and included a criteria referrencing the control on your form (Something like: Select TblName.* Where TblName.CriteriaField = Forms!HereGoesThenNameOfYourForm!HereTheNameOfYourControl)

Form the After update event of your combobox, you would do the following:

Docmd.OpenQuery "qryName",,acReadOnly
 

Users who are viewing this thread

Top Bottom