Does inputBox has "vbCancelOK" value as msgBox? Thanks

Joined
Jul 5, 2005
Messages
22
Reaction score
0
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!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top