Results 1 to 3 of 3
  1. #1
    jj1 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    128

    Messages pop up one after other ?

    My problem is I am using this code and MsgBox show up one after other however I want it show first popup for name and then person fills that info and next popup I don't know what I am missing in the code. Please help. I have a form on which people fill half info and scroll forward and open a new record so I am trying to block them doing so.


    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim YourName As String
    Dim cboCenter As String




    If IsNull(Me.[YourName]) Then
    Cancel = True
    MsgBox "You must provide Name"
    If (Me.[YourName]) <> "" Then
    Exit Sub
    End If
    End If


    If IsNull(Me.[cboCenter]) Then
    Cancel = True
    MsgBox "You must provide Center"
    If (Me.[cboCenter]) <> "" Then
    Exit Sub
    End If
    End If

    End Sub

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    Do not use similar variables and controlnames See this for more http://access.mvps.org/access/general/gen0012.htm
    Try this -
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    Dim UserName As String
    Dim cboCenterName As String
    
     
    If IsNull(Me.[YourName]) Then
    MsgBox "You must provide Name"
    Cancel = True
    Exit Sub
    End If
    
    
    
    If IsNull(Me.[cboCenter]) Then
    MsgBox "You must provide Center"
    Cancel = True
    Exit Sub
    End If
    
     
    End Sub

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,970
    Aside from an InputBox or opening another form in acDialog mode, I don't know any way to pause code execution after MsgBox to allow user input before next MsgBox popup.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Macro messages
    By GraemeG in forum Programming
    Replies: 1
    Last Post: 06-03-2011, 07:57 AM
  2. Messages
    By grankioto in forum Forms
    Replies: 1
    Last Post: 11-18-2010, 09:26 PM
  3. Warning messages
    By Bobcoop103 in forum Access
    Replies: 3
    Last Post: 08-12-2010, 11:45 PM
  4. Custom messages to Access' default error messages.
    By evander in forum Programming
    Replies: 1
    Last Post: 06-26-2010, 02:06 AM
  5. Error Messages
    By DataGeek in forum Access
    Replies: 0
    Last Post: 12-06-2007, 09:56 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