Here's another sample function you could use (and create something similar for dates and times) to make your life easier when putting SQL strings together...
Code:
Function EnquoteString(strText As String) As String
Enquote = "'" & strText & "'"
End Function
Which would be used like so...
Code:
Sub MyComboBoxQueryRowSourceThingee()
Dim strFirstName As String
Dim datBirthDate As Date
Dim intFavoriteInteger As Integer
Dim strSQL As String
strFirstName = "Marco"
datBirthDate = #6/28/2005# 'Note this is American format: Month/Day/Year
intFavoriteInteger = 19
strSQL = "SELECT peeps.strFirstName, peeps.strLastName, peeps.datBirthDate," _
& " peeps.intFavoriteInteger FROM tblPeople AS peeps" _
& " WHERE peeps.strFirstName=EnquoteString(strFirstName) _
& " AND peeps.datBirthDate=#" & datBirthDate & "#" _
& " AND peeps.intFavoriteInteger=" & intFavoriteInteger & ";"
Debug.Print strSQL
End Sub
I find using functions like this improves readability, and more importantly, it reduces mistakes.