Results 1 to 4 of 4
  1. #1
    desibabu90 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    39

    Adding Error Message

    Hey Everyone,

    I have a form that requires the user to input an ID number and using that ID number I have created a button that opens a different form with that same ID number.

    I wanted to know how to program an error code so if the user enters a non-existent ID number, the error message would display "Please Enter Correct ID"?

    Thanks!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Do a DLookup() or DCount() in the BeforeUpdate event of the ID control.

  3. #3
    desibabu90 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    39
    how exactly would this work? if Dlookup cannot find a record doesn't it return a null value? with the code i have, if i put in a non-existent ID it will just return a blank screen..i want an error message to pop up.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Put your MsgBox up in the BeforeUpdate event of the ID control and set Cancel = True to hold the focus in that control.

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

Similar Threads

  1. error message woes
    By ggs in forum Forms
    Replies: 4
    Last Post: 05-29-2011, 04:03 AM
  2. Error Message
    By Juan4412 in forum Forms
    Replies: 5
    Last Post: 03-06-2011, 04:22 PM
  3. error message
    By ngeng4 in forum Forms
    Replies: 85
    Last Post: 03-25-2010, 06:47 AM
  4. Error Message in Access2007
    By Storm91 in forum Access
    Replies: 3
    Last Post: 02-18-2010, 02:56 PM
  5. If / Then Error Message
    By Schwagr in forum Forms
    Replies: 4
    Last Post: 03-30-2006, 06:28 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