Compile Error: Syntax Error??

G

Guest

Hello All,

Can anyone help me? I have racked my brain on this one.. I have my invoice
form that I use to create new invoices and when I choose my invoice type, I
get this message:

Here is the code that the error points too (at the astrisx (*) )

begin code:
Private Sub cboinvoicetype_AfterUpdate()
If Nz(Me.invoicenumber, 0) = 0 Then
*Me.invoicenumber = Nz(DMax("invoicenumber", "tblinvoices", "invoicetype
= "'" & Me.invoicetype & "'"), 0) + 1
End If

If Me.cboinvoicetype = "Sold" Then
Me.invoicenumber = "SLD-" & Format(invoicenumber, "0000")
Else
If Me.cboinvoicetype = "Consignment" Then
Me.invoicenumber = "CON-" & Format(invoicenumber, "0000")
End If
End If







End Sub

end code:


I hope someone can help!

Please let me know if you need more information...

Brook
 
D

Dan Artuso

Hi,
Try this:

Me.invoicenumber = Nz(DMax("invoicenumber", "tblinvoices", "invoicetype = '" & Me.invoicetype & "'"), 0) + 1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DMAX 5
Invoice Payments Subform / Reset Balance Due? 6
Several questions 2
DMax 2
Custom Autonumber Help 10
Automation Number Sequence 2
find record in main form then find record in the subform 7
Receipt Number 2

Top