Results 1 to 5 of 5
  1. #1
    srferby is offline Novice
    Windows Vista Access 2003
    Join Date
    Apr 2010
    Posts
    2

    Using a range as a validation rule

    Full Disclosure: I did post issue on REDDIT yesterday but not in as much detail and I haven't received any assistance.

    I am creating a Database to track IPs that we block. I would like to create a Validation Rule that would not allow you to enter an IP within a CIDR range(This is in another table in the same db). I am also thinking that I don't want them to block known scanners(I haven't created table for this but it is not complicated IPAddress and owner). I know Access will not understand IP Addresses so I changed them to IP numbers [IPNumber]. I then have a field for Low and High CIDR blocks.

    So here is the process that I am looking for. Someone puts in an IP Address [IP Address] in table [IPs] the address is converted to a IP number [IP Number], that number is compared to [Low Number] and [High Number] if table [CIDR Range] if it is within that range the validation fails as the IP is already blocked the low and high range need to be in the same record.
    Table IP Table CIDR Range
    IP Address IP Number CIDR Range Low IP Low Number High IP High Number
    10.0.0.5 167772165 10.0.0.1/27 10.0.0.1 167772161 10.0.0.31 167772191
    10.2.0.6 167903238 10.3.0.1/24 10.3.0.1 167968769 10.3.0.254 167969022


    So 10.0.0.5 should not be allowed to be entered as it is in the range of 10.0.0.1/27. 10.2.0.6 should be allowed to be entered as it is not in a CIDR range but I don't want access to pick a low from one record and a high from another. Any help would be greatly appreciated. A great nice to have would be Validation text that says IP Address is covered by[CIDR Range].

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    do it similar to this:
    Attached Thumbnails Attached Thumbnails use dates in rate table.jpg  

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I am not understanding exactly what you are trying to do. Would you post your dB?

  4. #4
    CarlettoFed is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    255
    In the attachment you can see the example.
    Attached Files Attached Files

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe this is what you are wanting???
    Attached Files Attached Files

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 12-05-2017, 03:31 PM
  2. Replies: 2
    Last Post: 06-16-2015, 03:52 AM
  3. Validation Rule
    By rbiggs in forum Forms
    Replies: 4
    Last Post: 08-23-2011, 05:24 PM
  4. Validation Rule
    By robomose in forum Access
    Replies: 1
    Last Post: 09-09-2009, 05:59 AM
  5. Validation Rule
    By smitstev in forum Access
    Replies: 5
    Last Post: 06-30-2009, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums