Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Managing Hex Numbers

Status
Not open for further replies.

jade1001

Technical User
Aug 29, 2001
100
US
Hi,

Access Newbie here, I was wondering if anyone knew of a way where I can validate data entered in a table. Like for example, I'm asking my users to enter in their MAC address which is in hexidecimal. How can I get Access to check and make sure the user entered in a valid Heximdecimal number/MAC address and not a typo like a missing character or something? --There's bound to be someone who will type an O instead of an 0. :)

Thanks,
jade>:):O>
 
Something like this, in the BeforeUpdate event procedure of the control ?
txtMac = UCase(txtMac)
If Len(txtMac) <> 12 Then
Cancel = True
MsgBox "12 hex digits are required here"
Exit Sub
End If
For i = 1 To 12
If InStr("0123456789ABCDEF", Mid(txtMac, 1, 1)) = 0 Then
Cancel = True
MsgBox "12 hex digits are required here"
Exit Sub
End If
Next

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top