Results 1 to 6 of 6
  1. #1
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98

    I want to create a pop-up warning when a field in a customer record is NOT completed

    I'm sure this is very simple but I just can't find the solution... or I am doing something wrong.



    An Existing Customer records database includes a COMBO BOX with a pull down menu selection for the Unitary Authority (Governing local Council). Reports from this database use (rely on) this field and it must be completed, but the data entry people keep missing the field out.. I need the data entry folks to fill in the field before they can save the new record...

    I've tried using the Validation property and Validation Text and the Before Update Event with a few values, but I can't get it to work.

    Ideally, When the the user tries to move on or move away from the Customer record screen, they get a popup box that says "Unitary Authority MUST be completed"

    Guidance would be appreciated.

    =Jimbo=

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    This should help, but also the field should be made required in the table:

    http://www.baldyweb.com/BeforeUpdate.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98

    BeforeUpdate

    Quote Originally Posted by pbaldy View Post
    This should help, but also the field should be made required in the table:

    http://www.baldyweb.com/BeforeUpdate.htm
    Hi Paul,

    Many thanks for the prompt response to my post. I included the "Required" function in the table and it fundamentally does the job by presenting a dialog box which instructed me to enter a value in the field but that's all.

    I can't get the code to work in the properties of the Form. (I don't do VB, so I don't understand the code. I did try using the code in the BeforeUpdate function of the Form, but it doesn't work. Here's the code I used...

    Private Sub Form_BeforeUpdate ()
    If Len(Me.Un_Auth & vbNullString) = 0 Then
    MsgBox "You need to select a Unitary Authority"
    Cancel = True
    Me.Un_Auth.Set Focus
    End if
    End Sub

    The actual name of the field in question is "Un Auth" (Yes, there's a space in the name - Sorry!) and it's actually a Combo Box which allows the user to select from a list.

    Any suggestions?

    =Jimbo=

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What does "doesn't work" mean exactly? That wouldn't fire until an attempt was made to save the form data. That typically is when you move to another record or close the form after changing something. Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Jamescdawson is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Location
    South Wales, UK
    Posts
    98
    Quote Originally Posted by pbaldy View Post
    What does "doesn't work" mean exactly? That wouldn't fire until an attempt was made to save the form data. That typically is when you move to another record or close the form after changing something. Can you attach the db here?
    Hi Paul

    Sorry that's wasn't very good...was it ? I meant that having implemented the code (as attached) and having saved the form, then creating a new record, it didn't offer the pop up warning box and let me leave the record....

    HOWEVER.... I had actually made a couple of errors.... too embarrassed to tell you what they were () One of the errors can actually be seen in the code I sent to you.... There's a space between "Set" & "Focus"

    Bottom line... It works. Thanks again Esteemed master !!!

    Best Regards

    =Jimbo=

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Shows you how good my eyes are.

    Glad you got it working.
    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. Replies: 8
    Last Post: 11-01-2019, 01:46 AM
  2. Replies: 6
    Last Post: 11-21-2015, 09:52 AM
  3. Replies: 12
    Last Post: 05-30-2014, 07:08 AM
  4. How to create warning notice
    By bluepowa in forum Programming
    Replies: 3
    Last Post: 09-29-2009, 03:15 AM
  5. Replies: 0
    Last Post: 09-01-2009, 12:33 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