Dcount

G

guidop12

Is this the right syntax to add a sequence number to a table


Sequence: (DCount("[Total Revenue]","CompanyTwoYr","[Total Revenue] >=" &
[Total Revenue]))

Thanks
 
B

Bob Barrows [MVP]

guidop12 said:
Is this the right syntax to add a sequence number to a table


Sequence: (DCount("[Total Revenue]","CompanyTwoYr","[Total Revenue]
=" & [Total Revenue]))
Does it do what you want it to do? If so, it's correct.
 
G

guidop12

Why I asked is because when I run a join query to join two tables together
the query runs and displays the information but it will randomly pop up with
an error message that says

Syntax error (missing operator in query expression '[Total Revenue] >=')
So I'm figuring it comes from the DCount expression.


Bob Barrows said:
guidop12 said:
Is this the right syntax to add a sequence number to a table


Sequence: (DCount("[Total Revenue]","CompanyTwoYr","[Total Revenue]
=" & [Total Revenue]))
Does it do what you want it to do? If so, it's correct.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 
M

Michel Walsh

You field Total Revenue may have null in it, for some record, so AFTER the
concatenation of the strings is done (the third argument), that leads to:

"[Total Revenue] >="


same as if you asked:


4 >=


This is an error, since the string then missed the 'to what' (the right side
of the comparison).

Try:

Sequence: DCount("[Total Revenue]","CompanyTwoYr",
"[Total Revenue] >=" & Nz([Total Revenue], 1+DMax("[Total Revenue]",
"CompanyTwo Yr") ) )



where a record with a null value will then get a 'rank' (sequence number)
of 0 (since there is no record with the Total Revenue >= 1+ MAX(Total
Revenue) )


Vanderghast, Access MVP


guidop12 said:
Why I asked is because when I run a join query to join two tables together
the query runs and displays the information but it will randomly pop up
with
an error message that says

Syntax error (missing operator in query expression '[Total Revenue] >=')
So I'm figuring it comes from the DCount expression.


Bob Barrows said:
guidop12 said:
Is this the right syntax to add a sequence number to a table


Sequence: (DCount("[Total Revenue]","CompanyTwoYr","[Total Revenue]
=" & [Total Revenue]))
Does it do what you want it to do? If so, it's correct.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 
G

guidop12

That was perfect

Thanks

Michel Walsh said:
You field Total Revenue may have null in it, for some record, so AFTER the
concatenation of the strings is done (the third argument), that leads to:

"[Total Revenue] >="


same as if you asked:


4 >=


This is an error, since the string then missed the 'to what' (the right side
of the comparison).

Try:

Sequence: DCount("[Total Revenue]","CompanyTwoYr",
"[Total Revenue] >=" & Nz([Total Revenue], 1+DMax("[Total Revenue]",
"CompanyTwo Yr") ) )



where a record with a null value will then get a 'rank' (sequence number)
of 0 (since there is no record with the Total Revenue >= 1+ MAX(Total
Revenue) )


Vanderghast, Access MVP


guidop12 said:
Why I asked is because when I run a join query to join two tables together
the query runs and displays the information but it will randomly pop up
with
an error message that says

Syntax error (missing operator in query expression '[Total Revenue] >=')
So I'm figuring it comes from the DCount expression.


Bob Barrows said:
guidop12 wrote:
Is this the right syntax to add a sequence number to a table


Sequence: (DCount("[Total Revenue]","CompanyTwoYr","[Total Revenue]
=" & [Total Revenue]))

Does it do what you want it to do? If so, it's correct.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 

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