Hi guys,
I want to give user a prompt(inputBox) to input value of a field name of table
Private Sub form_open(Cancel As Integer)
On Error GoTo Err_Form_Open
...
Dim prompt As String
Dim inCity As String
Dim inAnswer As Integer
prompt = "Please input the CITY name:"
inCity = InputBox(prompt, "CITY")
intAnswer = ?????? <---how to code this? Question1
If intAnswer = vbCancel Then
Cancel = 1
Exit Sub
ElseIf intAnswer = vbOK Then
strSQL = "SELECT CITY, COUNT(*) AS [NUMBER OF STUDENTS] FROM " _
& Tb & " WHERE CITY = '" & _
inCity & "' GROUP BY CITY;"
End If
......
BTW,
Querstion2 ---how to make the input value is not case sensitive when query the table data?
Querstion2 ---is there a way to check the input value's validity based on the field's value in table?
I am novice, please give me details code. Thank you very much!!
I want to give user a prompt(inputBox) to input value of a field name of table
Private Sub form_open(Cancel As Integer)
On Error GoTo Err_Form_Open
...
Dim prompt As String
Dim inCity As String
Dim inAnswer As Integer
prompt = "Please input the CITY name:"
inCity = InputBox(prompt, "CITY")
intAnswer = ?????? <---how to code this? Question1
If intAnswer = vbCancel Then
Cancel = 1
Exit Sub
ElseIf intAnswer = vbOK Then
strSQL = "SELECT CITY, COUNT(*) AS [NUMBER OF STUDENTS] FROM " _
& Tb & " WHERE CITY = '" & _
inCity & "' GROUP BY CITY;"
End If
......
BTW,
Querstion2 ---how to make the input value is not case sensitive when query the table data?
Querstion2 ---is there a way to check the input value's validity based on the field's value in table?
I am novice, please give me details code. Thank you very much!!