P
Paul
I'm using a SQL Select statement as the Row Source of a combo box in a form
that works just fine for that purpose. But when I try to use that exact
same string in an assignment statement in a procedure, VBA can't interpret
the statement and dispays an compile error: "Expected: Then or Go To," at
the comma.
Here's the SQL statement that serves as the Row Source of the combo box:
SELECT tblContacts.ContactID, [LastName] & ", " & [FirstName] AS Name,
tblContacts.Organization FROM tblContacts ORDER BY [LastName] & ", " &
[FirstName];
When I try to use this exact same string in the following VBA statement:
If Me!cboSelectProject.RowSource = "SELECT tblContacts.ContactID, [LastName]
& ", " & [FirstName] AS Name, tblContacts.Organization FROM tblContacts
ORDER BY [LastName] & ", " & [FirstName];" Then . . .
the compiler crashes on the commas.
How can I tweak that SQL statement so that VBA will interpret it correctly?
Thanks in advance,
Paul
that works just fine for that purpose. But when I try to use that exact
same string in an assignment statement in a procedure, VBA can't interpret
the statement and dispays an compile error: "Expected: Then or Go To," at
the comma.
Here's the SQL statement that serves as the Row Source of the combo box:
SELECT tblContacts.ContactID, [LastName] & ", " & [FirstName] AS Name,
tblContacts.Organization FROM tblContacts ORDER BY [LastName] & ", " &
[FirstName];
When I try to use this exact same string in the following VBA statement:
If Me!cboSelectProject.RowSource = "SELECT tblContacts.ContactID, [LastName]
& ", " & [FirstName] AS Name, tblContacts.Organization FROM tblContacts
ORDER BY [LastName] & ", " & [FirstName];" Then . . .
the compiler crashes on the commas.
How can I tweak that SQL statement so that VBA will interpret it correctly?
Thanks in advance,
Paul