object doesn't support this property

Gavx

Registered User.
Local time
Tomorrow, 05:13
Joined
Mar 8, 2014
Messages
155
Another newbie question.

I have a form on which I have added a button.
On the On Click event I have attached this code;

Private Sub cmdInvoice_Click()
Me.cmdInvoice = Nz(DMax("[InvoiceNo]", "Booking"), 0) + 1

End Sub

The purpose of which is to create a new invoice number.
cmdInvoice is the name of the button, InvoiceNo is the name of the field in the Booking table.
It is reporting that the object doesn't support this method.
Why am I getting this error please?
Gavin
 
Last edited:
Because you're trying to set the value of a button. Set the value of a textbox bound to that field.
 
Thanks Paul,

I am trying to update the field InvoiceNo in the Booking table with the number this code creates.
Is the only way I can do this is create a text box on this form and bind it to this code (as you suggest above) and then have the InvoiceNo field with its Source as this text box?
 
Only way no, simplest way probably yes. In any case, you can't set the value of a button.
 
As per Paul's suggestion, try:

Code:
Private Sub cmdInvoice_Click()
Me.InvoiceNo = Nz(DMax("[InvoiceNo]", "Booking"), 0) + 1

End Sub
 

Users who are viewing this thread

Back
Top Bottom