SQL Where statement

  • Thread starter Thread starter Song Su
  • Start date Start date
S

Song Su

This works

Me.cboFund.RowSource = "SELECT DISTINCT qrysapbud.Fund,
qrysapbud.Funddesc.desc, qrysapbud.type " & _
"FROM qrysapbud ORDER BY qrysapbud.Fund"


But this does not. Is there any mistakes in that single/double quote at the
end? qrysapbud.type is character type.

Me.cboFund.RowSource = "SELECT DISTINCT qrysapbud.Fund,
qrysapbud.Funddesc.desc, qrysapbud.type " & _
"FROM qrysapbud ORDER BY qrysapbud.Fund WHERE funddesc.type = 'U'"
 
This works

Me.cboFund.RowSource = "SELECT DISTINCT qrysapbud.Fund,
qrysapbud.Funddesc.desc, qrysapbud.type " & _
"FROM qrysapbud ORDER BY qrysapbud.Fund"


But this does not. Is there any mistakes in that single/double quote at the
end? qrysapbud.type is character type.

Me.cboFund.RowSource = "SELECT DISTINCT qrysapbud.Fund,
qrysapbud.Funddesc.desc, qrysapbud.type " & _
"FROM qrysapbud ORDER BY qrysapbud.Fund WHERE funddesc.type = 'U'"

It doesn't for the same reason this sentence sounds strange work.

The WHERE clause must come before the ORDER BY clause.

Try

Me.cboFund.RowSource = "SELECT DISTINCT qrysapbud.Fund,
qrysapbud.Funddesc.desc, qrysapbud.type " & _
"FROM qrysapbud WHERE funddesc.type = 'U' ORDER BY qrysapbud.Fund;"
 
Got it. It works. Thanks a lot.

John W. Vinson said:
It doesn't for the same reason this sentence sounds strange work.

The WHERE clause must come before the ORDER BY clause.

Try

Me.cboFund.RowSource = "SELECT DISTINCT qrysapbud.Fund,
qrysapbud.Funddesc.desc, qrysapbud.type " & _
"FROM qrysapbud WHERE funddesc.type = 'U' ORDER BY qrysapbud.Fund;"
 
Back
Top