Syntax error?

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
 
T

tina

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
 
T

Tony Williams

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
 
T

tina

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
 
V

Van T. Dinh

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")
 
T

tina

oh, duh - i totally missed that, thanks Van! who said two heads were better
than one? more like, third head's the charm. <g>
 
T

Tony Williams

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>
 

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

Top