Syntax error?

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

Can anyone help with this formula?
= Format(Nz(DMax("InvNbr", "Invoices","ClientNbr=" & ClientID), 0) + 1),
"0000")
I am using it as a formula for a calculated control on a form. I get a
syntax error that says I must enclose my text data fields in quotes but all
the fields are numbers and that I may have entered an invalid comma or
omitted qutation marks?
TIA
Tony
 
try

= Format(Nz(DMax("[InvNbr]", "Invoices", "[ClientNbr] = " & [ClientID]), 0)
+ 1), "0000")

make sure that [ClientID] is a field included in the RecordSource of your
form, and that it is *not* the name of the control you're using the
expression in.

hth
 
Thanks Tina but still getting the same message?
Tony
tina said:
try

= Format(Nz(DMax("[InvNbr]", "Invoices", "[ClientNbr] = " & [ClientID]),
0)
+ 1), "0000")

make sure that [ClientID] is a field included in the RecordSource of your
form, and that it is *not* the name of the control you're using the
expression in.

hth


Tony Williams said:
Can anyone help with this formula?
= Format(Nz(DMax("InvNbr", "Invoices","ClientNbr=" & ClientID), 0) + 1),
"0000")
I am using it as a formula for a calculated control on a form. I get a
syntax error that says I must enclose my text data fields in quotes but all
the fields are numbers and that I may have entered an invalid comma or
omitted qutation marks?
TIA
Tony
 
hmm, i'm not seeing anything wrong with it. suggest you start by breaking
the expression down. run the DMax() by itself in the control first, to see
if that errs out. if it's ok, then add the Nz() to it and test again, then
the Format().

if the problem is your DMax() function, i can only suggest you double check
the spelling of the fields/tables, and the spacing. also make sure that
[InvNbr] and [ClientNbr] are fields in the Invoices table.

hth


Tony Williams said:
Thanks Tina but still getting the same message?
Tony
tina said:
try

= Format(Nz(DMax("[InvNbr]", "Invoices", "[ClientNbr] = " & [ClientID]),
0)
+ 1), "0000")

make sure that [ClientID] is a field included in the RecordSource of your
form, and that it is *not* the name of the control you're using the
expression in.

hth


Tony Williams said:
Can anyone help with this formula?
= Format(Nz(DMax("InvNbr", "Invoices","ClientNbr=" & ClientID), 0) + 1),
"0000")
I am using it as a formula for a calculated control on a form. I get a
syntax error that says I must enclose my text data fields in quotes but all
the fields are numbers and that I may have entered an invalid comma or
omitted qutation marks?
TIA
Tony
 
You got 3 opening parentheses and 4 closing parentheses.

My guess is that you want:

= Format(Nz(DMax("InvNbr", "Invoices","ClientNbr = " & ClientID), 0) + 1,
"0000")
 
oh, duh - i totally missed that, thanks Van! who said two heads were better
than one? more like, third head's the charm. <g>
 
Thanks to you both
Tony
tina said:
oh, duh - i totally missed that, thanks Van! who said two heads were
better
than one? more like, third head's the charm. <g>
 
Back
Top