Results 1 to 5 of 5
  1. #1
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16

    Question Custom warning

    I have a form that I would like to create a custom warning in. If a field contains a specific value (which is based off of a drop down list linked to a parent table), then I would like the warning I create to pop up. Here is what I tried using in VBA, with no success. It keeps highlighting the first line in yellow, and I do not know how to correct that error. I don't even know what it means when it does that. I am very new to Access - please use small words. "VendorCode" is the field, "CLOSET" is the specific item from the drop down list that I need to trigger a warning. TIA



    Private Sub VendorCode_GotFocus()

    IIf [VendorCode] = "CLOSET", "WARNING!! Needs Additional Paperwork - Please see notes."

    End Sub

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    You probably need a message box to pop up with your warning. Look at this tutorial and try doing the coding yourself. If you run into issues, post back with what is not working for you and what you have done.

    http://www.datapigtechnologies.com/f...xinputbox.html

    Alan

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    Code:
    If [VendorCode] = "CLOSET" Then
         MsgBox  "WARNING!! Needs Additional Paperwork - Please see notes."
    End If
    I would disambiguate [VendorCode] by specifying the control that contains it:

    Me.VendorCode

    or whatever the name is.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16
    pbaldy - thanks so much! Worked exactly how I needed it to!

    alansidman - thanks for the link to the tutorial - more knowledge is always helpful.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    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. set warning off
    By bet in forum Programming
    Replies: 2
    Last Post: 03-27-2011, 04:21 PM
  2. security warning
    By wthoffman in forum Access
    Replies: 3
    Last Post: 02-26-2011, 09:22 AM
  3. Warning messages
    By Bobcoop103 in forum Access
    Replies: 3
    Last Post: 08-12-2010, 11:45 PM
  4. Access warning message
    By John Southern in forum Access
    Replies: 2
    Last Post: 05-28-2010, 06:01 AM
  5. Security Warning
    By mojo53777 in forum Security
    Replies: 0
    Last Post: 11-16-2007, 06:23 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