antonyx
Arsenal Supporter
- Local time
- Today, 08:37
- Joined
- Jan 7, 2005
- Messages
- 556
ok have a look at this..im trying to create an invoice number using the account reference.. (from a drop down) and a random 5 digit number..
i want the form to check the invoice table (invoiceref field).. to make sure that invoice number doesnt already exist.
error 2001 on the above line. you cancelled the previous operation..
what am i doing wrong?
i want the form to check the invoice table (invoiceref field).. to make sure that invoice number doesnt already exist.
Code:
Private Sub btnGenerate_Click()
Dim rdm As Long
Dim xlook As Variant
Do
[b]xlook = DLookup("InvoiceRef", "tblInvoice", "Criteria = '" & Forms!frmGenerateInvoice!txtinvoicenotest & "'")[/b]
rdm = Int((99999 - 11111 + 1) * Rnd + 11111)
Me.txtinvoicenotest = Me.cboAccountRef & rdm
Loop Until xlook <> Me.txtinvoicenotest
Me.txtinvoiceno = Me.txtinvoicenotest
End Sub
error 2001 on the above line. you cancelled the previous operation..
what am i doing wrong?