Results 1 to 4 of 4
  1. #1
    huffjd is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    2

    Use DLOOKUP to Validate User's Entry? Pls Help...

    I am extremely new to MS Access and have reached a barrier that I hope someone can help me with. I am trying to validate a user’s entry(s) into a form’s text fields against a table. I believe this can be accomplished with a DLOOKUP but nothing I have tried seems to work. Any help would be greatly appreciated! Below are the details (using Access 2007)

    Two Tables

    1. TblOvrStock

    Fields

    OvrLoc1 (Format: ## EX: 10)



    OvrLoc2 (Format: ## EX: 01)

    OvrLoc3 (Format: ## EX: 05)

    OvrLoc4 (Format: ## EX: 12)

    PckLoc1 (Format: ## EX: 20)

    PckLoc2 (Format: ## EX: 05)

    PckLoc3 (Format: ## EX: 04)

    PckLoc4 (Format: ## EX: 01)

    2. TblValidLoc

    Fields

    ValidOvrLoc (Format: ######## EX: 10010512)

    ValidPckLoc (Format: ######## EX: 20050401)



    One Form:

    · The first four fields (two digits each) represent a warehouse ‘overstock’ location

    § TxtOvrLoc1 (EX: 10)

    § TxtOvrLoc2 (EX: 01)

    § TxtOvrLoc3 (EX: 05)

    § TxtOvrLoc4 (EX: 12)

    · The other four fields represent a warehouse ‘pick’ location

    § TxtPckLoc1 (EX: 20)

    § TxtPckLoc2 (EX: 05)

    § TxtPckLoc3 (EX: 04)

    § TxtPckLoc4 (EX: 01)

    The form is intended to insert records into a table (TblOvrStock)

    Before the records are inserted, I need to validate that the entries made in The TxtOvrLoc1,2,3,4 fields match a location in the ValidOvrLoc column of TblValidLoc

    If match, then proceed with new record insert

    If no match, cancel new record insert and error msg “Not a valid overstock location”

    AND validate that the entries made in The TxtPckLoc1,2,3,4 fields match a location in the ValidPckLoc column of TblValidLoc

    If match, then proceed with new record insert

    If no match, cancel new record insert and error msg “Not a valid pick location”

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You haven't posted your code attempt so we can fix it. That said, a simpler solution might be to use combo boxes with limit to list set to yes. That way a user can't select an incorrect location.

    By the way, numbered fields like that is almost always a mistake. You should probably have a related table where each location is a record. Sooner or later somebody is going to decide that they need 5 locations, and your whole application will have to be revised.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    huffjd is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    2
    Paul

    Thanks for the feedback. I thought about the Combo Box option but there will be over 10,000 location options. The users will be using a 10-key pad so I need to keep this as simple as possible for the users.

    I haven't even gotten as far as to develop any code. Would you happen to have example code that I could learn from and try to fit to my needs?

  4. #4
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Oh; you said "nothing I have tried seems to work", so I thought you had tried it. Here's a good reference on DLookup syntax:

    DLookup Usage Samples

    I might still consider a combo box. The user can still type in their input; they don't have to scroll/select.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. update a form with user's imput
    By nianko in forum Forms
    Replies: 3
    Last Post: 08-25-2010, 08:52 AM
  2. Replies: 5
    Last Post: 08-20-2010, 09:10 AM
  3. Change a User's Group
    By Ted C in forum Security
    Replies: 1
    Last Post: 07-16-2010, 09:20 AM
  4. how to validate the first line of address
    By dunners92 in forum Access
    Replies: 1
    Last Post: 03-15-2010, 09:53 PM
  5. Replies: 2
    Last Post: 11-04-2009, 09:45 PM

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