Combo Box Question

C

Carl Mankat

I'm using Access 2K and W2K.

I have a combo box (Combo0) that allows the selection of a last name. I
have the following lines of code to see if it is empty when I process
the data:

Private Sub Command4_Enter()
If IsNull(Combo0) Then
MsgBox "Please Select teacher"
Me.Combo0.SetFocus
End If
End Sub

I would like to insure that the off chance of someone typing in a number
doesn't egt through and results in a blank form.
What's the best way to keep a number from getting through?

TIA,

Carl
 
K

Ken Snell [MVP]

The IsNumeric function may work for you:

Private Sub Command4_Enter()
If IsNull(Combo0) = True Or IsNumeric(Combo0) = True Then
MsgBox "Please Select teacher"
Me.Combo0.SetFocus
End If
End Sub
 
C

Carl Mankat

Ken said:
The IsNumeric function may work for you:

Private Sub Command4_Enter()
If IsNull(Combo0) = True Or IsNumeric(Combo0) = True Then
MsgBox "Please Select teacher"
Me.Combo0.SetFocus
End If
End Sub
Thanks Ken,

I have a question and that is how do I learn about such things as the
IsNumeric Function? I'm
still learning those sorts of things and could use some guidance.

Thanks,

Carl
 
K

Ken Snell [MVP]

Carl Mankat said:
Thanks Ken,

I have a question and that is how do I learn about such things as the
IsNumeric Function? I'm
still learning those sorts of things and could use some guidance.

Well, there is the brute force way: read/search the Help files and look at
the table of contents (VBA Help portion) under the functions.

Or searching newsgroups.

Or getting a book on VBA for ACCESS (one is Beginning ACCESS 2002 VBA by
Smith and Sussman -- and there are others).

Or asking questions here in newsgroup.

I don't recall how I learned of this function, so I cannot relate that
story.... < g >
 

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