What's Wrong

O

OldManEd

The following works in a VBA function: "Function Rank(FamilyLookUp as
variant) as variant "
"End Function

strSQL = "SELECT FamilyRank FROM tblAllIndividuals2000 WHERE FamilyID = " &
FamilyLookUp & " & ";"

-----------------------------------------------

I now want to order the field [FamilyRank] but this modified SQL statement
doesn't work. What's wrong with it?

strSQL = "SELECT FamilyRank FROM tblAllIndividuals2000 WHERE FamilyID = " &
FamilyLookUp & "ORDER BY FamilyRank" & ";"

Must all VBA SQL SELECT statements end with a semi-colon?
 
D

Douglas J. Steele

The semicolon is always optional.

You're missing a space between the value of FamilyLookUp and the ORDER BY
keyword.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top