S
scott
I've having problems with my vba sql syntax. When changing my forms
RecordSource with CODE 2 below, I get an error. CODE 1 works fine, but I
can't seem to concatenate the ORDER BY after the WHERE clause varible.
Me.idControl is an integer type. What am I doing wrong?
I should mention that this is an access adp file, but I don't think that
should matter.
CODE 1 ********************************
sSQL = "SELECT myField1, myField2 " & _
"FROM myTable " & _
"WHERE myField1= " & Me.idControl
CODE 2 ********************************
sSQL = "SELECT myField1, myField2 " & _
"FROM myTable " & _
"WHERE myField1= " & Me.idControl & " " & _
"ORDER BY myField2"
RecordSource with CODE 2 below, I get an error. CODE 1 works fine, but I
can't seem to concatenate the ORDER BY after the WHERE clause varible.
Me.idControl is an integer type. What am I doing wrong?
I should mention that this is an access adp file, but I don't think that
should matter.
CODE 1 ********************************
sSQL = "SELECT myField1, myField2 " & _
"FROM myTable " & _
"WHERE myField1= " & Me.idControl
CODE 2 ********************************
sSQL = "SELECT myField1, myField2 " & _
"FROM myTable " & _
"WHERE myField1= " & Me.idControl & " " & _
"ORDER BY myField2"