Queries in If Statements

  • Thread starter Thread starter longIT
  • Start date Start date
L

longIT

Guest
I'm trying to insert a query into an If Statement. The user will pick the make of the car & then the models of that make should appear below it. The code I'm using at the moment is

If Make = "AC" Then
Model = AC Query;
End If
End Sub

I've also tried using

If Make = "AC" Then
Model = "Ace, Cobra"
End If

But this produces

Ace, Cobra in the model combo box and not a list.

Hope someone can help me on this.
 
Got it!!

Finally managed to get it to work. Here's what I did in case anyone else has these problems:

1.Make 2 tables:

tblMake
Make (list Makes)

tblModel
Model (list all models)
Make (list all make of model)



2.Make 2 quereis

QryMake
SELECT [tblMake].[Make]
FROM tblMake
ORDER BY [tblMake].[Make];

QryModel
SELECT [tblModel].[Model]
FROM tblModel
WHERE [tblModel].[Make]=[FORMS]![Add New Vehicle]![cboMake]
ORDER BY [tblModel.Model];



3.On a form place 2 combo boxes

cboModel
Rowsource: QryMake

cboModel
Rowsource: QryModel
 

Users who are viewing this thread

Back
Top Bottom