troubleshooting Question

How copy record to a different table if certain criteria exists

Avatar of SteveL13
SteveL13Flag for United States of America asked on
Microsoft Access
7 Comments1 Solution432 ViewsLast Modified:
On a form I have a command button and when the user clicks the button I want the record displayed on the form to be copied to a separate table via a update query which I have already designed.  The fields are the same in both tables.

Also on the form is a checkbox.  If the checkbox is true then I want a message box to appear allowing the user to back out of the routine OR overwrite the existing record.  The key field is "Invoice #" in both tables or "txtInvoice#" on the form.

Here is my code but its not working.

Private Sub cmdCopyRecToRevTbl_Click()

    If Me.chkbxRecCopiedToRevTbl = True Then
        If MsgBox("You have already copied this record to the Revenue table.  Click No to abort.  Click Yes to overwrite the existing record.", vbYesNo + vbQuestion + vbDefaultButton2) = vbYes Then
        DoCmd.OpenQuery "updqryCopyInvToRevTable", acViewNormal, acAdd
        End If
    End If
End Sub
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros