I have inserted the Execute statement in the following code below to run an update query to update the date the labels were printed. It works great, however, when I go to design mode after testing, I get the error "You do Not have Exclusive Access to the Database". I physically have to get out of the database and get back in to continue. I am new to VB, so I would greatly appreciate any help. Thanks.
Private Sub cmdPrintBulkBagLabelsCrystal_Click()
On Error GoTo Err_cmdPrintBulkBagLabelsCrystal_Click
CrystalReport2.ReportFileName= "M:\AccessDatabases\Inventory\PPProductionLabelsBulkBags.rpt"
CrystalReport2.Destination = crptToPrinter
CrystalReport2.Action = 1
If MsgBox("Did labels print correctly?", vbYesNo) = vbYes Then
CurrentDb.Execute "qryPPUpdateBulkBagCCLabelsPrinted"
Else
End If
Exit_cmdPrintBulkBagLabelsCrystal_Click:
Exit Sub
Err_cmdPrintBulkBagLabelsCrystal_Click:
MsgBox Err.Description
Resume Exit_cmdPrintBulkBagLabelsCrystal_Click
End Sub
Private Sub cmdPrintBulkBagLabelsCrystal_Click()
On Error GoTo Err_cmdPrintBulkBagLabelsCrystal_Click
CrystalReport2.ReportFileName= "M:\AccessDatabases\Inventory\PPProductionLabelsBulkBags.rpt"
CrystalReport2.Destination = crptToPrinter
CrystalReport2.Action = 1
If MsgBox("Did labels print correctly?", vbYesNo) = vbYes Then
CurrentDb.Execute "qryPPUpdateBulkBagCCLabelsPrinted"
Else
End If
Exit_cmdPrintBulkBagLabelsCrystal_Click:
Exit Sub
Err_cmdPrintBulkBagLabelsCrystal_Click:
MsgBox Err.Description
Resume Exit_cmdPrintBulkBagLabelsCrystal_Click
End Sub