Compile Error: Syntax Error??

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Hi,
Try this:

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