How to validate Textbox Value using Table Values?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Brendan Wolf
    New Member
    • Oct 2010
    • 5

    How to validate Textbox Value using Table Values?

    Good Morning,

    I would like to validate a value entered in a textbox to make sure it matches one of the values in a table. The approach I took is a dlookup, but I can only get it to work for one of the values (the first one)

    Here is my code

    Code:
    If Me.AFOs.Value <> DLookup("AFO", "AFO_LOOKUP", "Office = '" & Me.Approver_Office.Value & "'") Then Me.AFOs.enabled = True And MsgBox("AFO(s)Invalid. Please enter valid AFO and format AFO,AFO for single Service Center and format with a space between AFOs for multiple Service Centers (AFO, AFO)")
    I am guessing my criteria is bad or the table design is bad. My table is below. I would like to make sure the value in the textbox AFOs matches one of the values in the AFO column when I submit my form.

    Office AFO
    NASHVILLE 101
    NASHVILLE 101, 259
    NASHVILLE 101,259
    NASHVILLE 101259
    NASHVILLE 259
    NASHVILLE 259101

    I would greatly appreciate any help! Thank you!
  • Brendan Wolf
    New Member
    • Oct 2010
    • 5

    #2
    Hey guys, I am still stuck on this...I would appreciate any help. If you need more detail let me know.

    Comment

    Working...