How to code a query with a prompt for entering a parameter value? Really thanks.

Joined
Jul 5, 2005
Messages
22
Reaction score
0
Hi Guys,

In my application system design, user enters the value with prompt message window,
then generate report based on this value of the query.

I code it as following but not work: (CITY is a field name of the table)
...
Dim strSQL As String

strSQL = "SELECT CITY, COUNT(*) AS [NUMBER OF STUDENTS] FROM " _
& TABLE_NAME & " WHERE CITY = [Enter CITY] GROUP BY CITY;"

Me.RecordSource = strSQL
...

if as saving query, it will works, but in code not. why? how to do that?
should i use inputbox or a form instead?

BTW, how to make the input value is not case sensitive when query the table data?


Thanks a lot!!
 
Last edited:
Back
Top