D
Dudley
My accounting database in Access 2002 has a function to create a one off
invoice as follows:
Private Sub Create_New_Invoice_Click()
Dim NewIN As Long
Dim ThisDate
On Error GoTo errcust
ThisDate = InputBox("What date should the new invoice be dated with?",
"Date of Invoicing", Date)
If ThisDate = "" Then Exit Sub
DoCmd.SetWarnings False
DoCmd.Hourglass True
NewIN = NewInvoiceNumber()
DoCmd.RunSQL "UPDATE Enquiries " & "SET [Invoice Number] = " & _
NewIN & " WHERE ([Customer Code] = '" & _
Me![Customer Code Field] & "') AND ([Invoice Number] = 0);", False
DoCmd.RunSQL ("INSERT INTO Invoices ([Invoice Number],[Customer
Code],[Creation Date],[One Off?]) " & _
"VALUES (" & NewIN & ",'" & Me![Customer Code Field] & "','" &
ThisDate & "', Yes);")
DoCmd.OpenForm "Invoices", , , "[Invoice Number]=" & NewIN
DoCmd.Hourglass False
errcust:
DoCmd.SetWarnings True
DoCmd.Hourglass False
End Sub
This has worked for years, but now it has started locking up two out of
three times it is run, and when I do Ctrl/Alt/Del it says Access not
responding.
Can anyone help please?
Thanks
Dudley
invoice as follows:
Private Sub Create_New_Invoice_Click()
Dim NewIN As Long
Dim ThisDate
On Error GoTo errcust
ThisDate = InputBox("What date should the new invoice be dated with?",
"Date of Invoicing", Date)
If ThisDate = "" Then Exit Sub
DoCmd.SetWarnings False
DoCmd.Hourglass True
NewIN = NewInvoiceNumber()
DoCmd.RunSQL "UPDATE Enquiries " & "SET [Invoice Number] = " & _
NewIN & " WHERE ([Customer Code] = '" & _
Me![Customer Code Field] & "') AND ([Invoice Number] = 0);", False
DoCmd.RunSQL ("INSERT INTO Invoices ([Invoice Number],[Customer
Code],[Creation Date],[One Off?]) " & _
"VALUES (" & NewIN & ",'" & Me![Customer Code Field] & "','" &
ThisDate & "', Yes);")
DoCmd.OpenForm "Invoices", , , "[Invoice Number]=" & NewIN
DoCmd.Hourglass False
errcust:
DoCmd.SetWarnings True
DoCmd.Hourglass False
End Sub
This has worked for years, but now it has started locking up two out of
three times it is run, and when I do Ctrl/Alt/Del it says Access not
responding.
Can anyone help please?
Thanks
Dudley