Syntax Error

FranD

Registered User.
Local time
Today, 12:11
Joined
Feb 29, 2000
Messages
32
I'm getting a syntax error in one of my modules and I think I know what the problem is but don't know how to fix it. Here's the syntax:

Dim strWhereGroupDivision
strWhereGroupDivision = "Division = """ & Forms![frmDialog]!cboSelDivision & """ and Group# = """ & Forms![frmDialog]!cboSelGroup & """"

I think the problem is that the "Division" field is a text field and "Group#" is a number (long interger) field. And I think the syntax I'm using is strictly for text...

Can anyone help... PLEASE

THANKS Fran
 
Try

strWhereGroupDivision = "Division = '" & Forms![frmDialog]!cboSelDivision & "' and Group# = '" & Forms![frmDialog]!cboSelGroup & "'"

or

strWhereGroupDivision = "Division = " & Forms![frmDialog]!cboSelDivision & " and Group# = " & Forms![frmDialog]!cboSelGroup
 
Thanks IIkhoutx, but I tried both variations and neither is working.

Do you think the string variable is the problem. Obviously I don't know what the problem is, but I'm thinking that it's because the group# field is a numeric data type while the division field is text.

Any other suggestions?
 
Try:

strWhereGroupDivision = "Division = '" & Forms![frmDialog]!cboSelDivision & "' and Group# = " & Forms![frmDialog]!cboSelGroup

You must have single quotes around the text variable. You cannot have quotes around an integer variable.
 
Thank You....Thank You....Thank You
It worked!!!

Fran
 

Users who are viewing this thread

Back
Top Bottom