I am currently writing a program in VBA and when I execute the following SQL code I get a too few parameters expected 1. What is wrong with this code and why am I getting the error message?
dim Dbs As database
Set Dbs = CurrentDb
Me.STATE.SetFocus
tempgroup = Me.STATE.Text
sSQL = "Select STATE, [AVG ANNUAL PRECIP (inches)] From Table1 Where [STATE]= '" & tempgroup & "' order by [avg annual precip (inches)] "
Set MyRS = Dbs.OpenRecordset(sSQL, dbOpenDynaset)
I have to use the brackets around AVG ANNUAL PRECIP (inches) because if I don't I get a type mismatch error.
Does anyone have any suggestions?
dim Dbs As database
Set Dbs = CurrentDb
Me.STATE.SetFocus
tempgroup = Me.STATE.Text
sSQL = "Select STATE, [AVG ANNUAL PRECIP (inches)] From Table1 Where [STATE]= '" & tempgroup & "' order by [avg annual precip (inches)] "
Set MyRS = Dbs.OpenRecordset(sSQL, dbOpenDynaset)
I have to use the brackets around AVG ANNUAL PRECIP (inches) because if I don't I get a type mismatch error.
Does anyone have any suggestions?