IP Address Conditional Formatting

  • Thread starter cokparae via AccessMonster.com
  • Start date
C

cokparae via AccessMonster.com

What I am trying to accomplish is using that same form to enter an IP Address
(value #1) and that address checking itself against another field (value #2)
in the same query. I am dealing with IP addresses so I assumed it is a Long
Integer. If the first three octets of value #1 match the first three octets
of the value #2 in the same query, return value 1 &2, if not decrease by 1
until there is a match. If there is no record of value 1, return “No Recordâ€.
I am not sure if I have to use VBscript on Expression builder. I have tried
both and have not be as successful as I would of like to.

Any help would be appreciated.

C
 
B

BruceM

It should probably be text, not long integer. Are you storing this in
several fields, or in one field? If the latter, are you storing the dots?
I would think you need to, since not every octet is three digits.
What do you mean by "another field in the same query"? Does the IP address
appear in several locations within one record (field1 and field2)? If so,
to what end? I expect you could use DCount in the After Update event for
the Field1 text box, maybe something like:

Dim strFieldOne as String, strWhere as String
strFieldOne = Me.txtField1
strWhere = "[Field2] = """ & strFieldOne & """"
If DCount("[Field2]","YourTable",strWhere) > 0 Then
MsgBox "Number already in use"
Cancel = True
End If

This assumes that both fields are text fields. txtField1 is the text box
bound to Field1.
 

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

Similar Threads


Top