Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DCount Problem

Status
Not open for further replies.

Binnit

Technical User
Apr 28, 2004
627
US
I have a DCount statement which appears to work but fails.

Code:
If DCount("[expaltref]", "tblRiskDetails", "EXPPolicyNO] = '" & Me.txtEXPPolicyNo & "'And [expaltref]= '" & Me.cmbEXPAltRef & "'") >= 1 Then

Both the values Me.txtEXPPolicyNo / Me.cmbEXPAltRef are passed in (as can be seen when debug halts it) and I am getting a runtime error 3075.

Both controls are text controls and both fields are text fields so anyone know what is going wrong with my statement?

If IT ain’t working Binnit and Reboot
 
OK... sorry I've spotted the missing "[" in "EXPPolicyNO]

Problem solved....

Thanks for looking anyway!

If IT ain’t working Binnit and Reboot
 
Hi!

It looks like you need to remove the single quotes, at least the first set:

If DCount("[expaltref]", "tblRiskDetails", "EXPPolicyNO] = " & Me.txtEXPPolicyNo & " And [expaltref]= '" & Me.cmbEXPAltRef & "'") >= 1 Then


Also, you didn't have a space between the single quote and the And. If expatref is numerical then remove the single quotes there too.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top