Can someone check my DCount function?

R

Robert Johnson

Hi all. I am having a problem with using DCount. Here is my code:

varLWM = Me.lgVwMatchLine.Value
varResults = DCount("LgVwMatchLine", "[Circuit Table]", "[LgVwMatchLine]
= varLWM ")

What am I doing wrong?

TIA

Robert
 
A

Andrew Smith

If varLWM is a number it should be:

varResults = DCount("LgVwMatchLine", "[Circuit Table]", "[LgVwMatchLine]=" &
varLWM )

If varLWM is a string then it should read:

varResults = DCount("LgVwMatchLine", "[Circuit Table]", "[LgVwMatchLine]='"
& varLWM & "'")
 
R

Robert Johnson

Thank you Andrew. The example in help just didn't do it for me.

Robert
Andrew Smith said:
If varLWM is a number it should be:

varResults = DCount("LgVwMatchLine", "[Circuit Table]", "[LgVwMatchLine]=" &
varLWM )

If varLWM is a string then it should read:

varResults = DCount("LgVwMatchLine", "[Circuit Table]", "[LgVwMatchLine]='"
& varLWM & "'")


Robert Johnson said:
Hi all. I am having a problem with using DCount. Here is my code:

varLWM = Me.lgVwMatchLine.Value
varResults = DCount("LgVwMatchLine", "[Circuit Table]", "[LgVwMatchLine]
= varLWM ")

What am I doing wrong?

TIA

Robert
 

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

Access Dcount function in access 0
DCount alwaysreturning 1 0
Access MS Access DCount function problem 0
dcount won't work? 1
Dcount return incorrect result for filtered record 4
dcount(multiple criteria) 4
dcount 1
DCount problem 6

Top