Results 1 to 4 of 4
  1. #1
    FormerJarHead is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    52

    Another Message Box Question

    I had a question about message boxes which June was able to guide me through. On my subform I have a text box that allows the user to enter data. If they do, the following message appears (code included):

    [Private Sub Decline_BeforeUpdate(Cancel As Integer)
    Dim strMsg As String
    Dim iResponse As Integer
    strMsg = "A record has been entered into AdSeg Decline? Is this entry correct or should it be entered into your 20000 record? "
    iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
    If iResponse = vbNo Then
    Cancel = True
    Else
    Cancel = False


    End If
    End Sub]

    This is not exactly what June gave me...I did some more searching and found this and tried it...Seems to work well but not where I need it to be...

    Now that I've had a chance to mess around with this, how can I get it to delete the entry if data is entered in error? I've tried this code (purple) with no luck. Is what I want to do possible? This is a text box in a subform. I've searched through this and other forums with no luck. Any assistance is appreciated.

    [Private Sub Decline_BeforeUpdate(Cancel As Integer)
    Dim strMsg As String
    Dim iResponse As Integer
    strMsg = "A record has been entered into AdSeg Decline? Is this entry correct or should it be entered into your 20000 record? "
    iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
    If iResponse = vbNo Then
    DoCmd.RunCommand acCmdUndo and also Me.Undo
    Cancel = True
    End If
    End Sub]

    Thank you for any help...

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Ideal approach would be to use the FORM BeforeUpdate event to cancel the entire record edit if certain condition exists.
    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.

  3. #3
    FormerJarHead is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Posts
    52
    I'll try it...Will it remove all the entries or just the last entry? The subform is designed in datasheet view because this is how the end user would prefer to view their data. And would the code above work for that specific field in the subform? How does it know to look at the "Decline" field?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    It will reverse any edits on the record.
    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. Replies: 2
    Last Post: 01-23-2014, 12:40 PM
  2. Replies: 15
    Last Post: 11-01-2013, 03:24 PM
  3. Replies: 4
    Last Post: 02-21-2013, 08:19 AM
  4. Replies: 9
    Last Post: 09-26-2012, 12:20 PM
  5. Message Box question
    By bullwinkle55423 in forum Programming
    Replies: 1
    Last Post: 08-12-2010, 09:01 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