We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Private Sub cboVendorName_BeforeUpdate(Cancel As Integer) Dim curDB As DAO.Database Dim strSQL As String Dim rs As DAO.Recordset Dim X As Integer Dim ctl As Control Dim frm As AccessObject Set curDB = CurrentDb gContractID = Me.ContractNumber gInvID = Me.IDInvoice strSQL = "SELECT RecordLock" & _ " FROM tblinvoice" & _ " WHERE (((ContractNumber)=" & Chr(34) & gContractID & Chr(34) & ") AND ((RecordLock)=False))" Set rs = curDB.OpenRecordset(strSQL) If rs.RecordCount > 0 Then Select Case MsgBox("Sorry unable to process request until previous Invoice has been printed." _ & vbCrLf & "" _ & vbCrLf & "Do you wish to print last Invoice entry?" _ , vbYesNoCancel Or vbCritical Or vbDefaultButton1, "Invoice Needs to be Printed") Case vbYes DoCmd.OpenReport "rptAPCodingSlip", acViewPreview, "IDInvoice = " & Chr(39) & gInvID & Chr(39) & "" DoCmd.OpenReport "rptInvoiceActivity_Slip", acViewPreview, "ContractNo = " & Chr(34) & gContractID & Chr(34) & "" '>>>>> If X = 0 Then DoCmd.RunSQL "Update tblinvoice Set RecordLock = -1 where IDInvoice = " & gInvID & "" End If Case vbNo Or vbCancel Exit Sub End Select End If End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.