Results 1 to 4 of 4
  1. #1
    scoe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    91

    Smile Use a command button to remove data from a record


    Hi, being new at VBA I am struggling a little and would be greatful for more advice.
    I have a button in the detail section on a continuous form that when clicked brings up a message asking if you want to edit the record, if 'yes' I need two fields deleted, the tick out of the [TBC] chkbox and the date from the [ClaimDate]which is drawn from the table.
    So far I have the following code but only the message works.
    [Private Sub Command138_Click()
    MsgBox "Are you sure you want to edit recorded claim?"
    Style = vbQuestion + vbYesNo
    If Response = vbYes Then
    Me.TBC = False
    End If
    End Sub]

    Any help would be greatly appreciated

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You need to catch the response in a variable, i.e.
    Code:
    Private Sub Command138_Click()
    
        Dim myResponse
    
        myResponse = MsgBox("Are you sure you want to edit recorded claim?",vbYesNo)
        If myResponse = vbYes Then
           Me.TBC = False
           Me.ClaimDate = ""
        End If
    
    End Sub

  3. #3
    scoe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    91
    Thank you so much, it's worked with the date just need to get it to take out the tick, not sure why it is ignoring that part but getting closer, thank you.

  4. #4
    scoe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    91
    Thank you, my error (mispelled the check box) works brilliantly

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

Similar Threads

  1. Help Me! Save Record Command Button issue
    By gszdwml in forum Programming
    Replies: 1
    Last Post: 04-24-2012, 09:53 AM
  2. Replies: 3
    Last Post: 03-07-2012, 09:49 AM
  3. Replies: 4
    Last Post: 07-22-2011, 12:52 PM
  4. Updating another record table with command button
    By erlan501 in forum Programming
    Replies: 5
    Last Post: 04-26-2010, 09:03 AM
  5. Command button help - delete record
    By Zukster in forum Forms
    Replies: 0
    Last Post: 08-27-2009, 08:47 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