bug check, must be blind

Thales750

Formerly Jsanders
Local time
Today, 01:35
Joined
Dec 20, 2007
Messages
3,360
hey guys

would someone check this please

This works:

Code:
LOCCONCurent = DCount("ContactID", "tblContactLocation", "tblContactLocation.ContactID=[Forms]![frmContactNew]![ContactID]")

This apperently does not:

Code:
LOCCONCurent = DCount("ContactID", "tblContactLocation", "tblContactLocation.ContactID=[Forms]![frmContactNew]![ContactID]" And ((tblContactLocation.ContactOfficeStatus) = "current"))

thanks, all these senior moments are making me old.
 
Last edited:
The "AND" needs to be inside the quotes, too.

You wrote Dsomething( x, y, "A" and "B") but it needs to be Dsomething(x,y,"A AND B")
 
Code:
LOCCONCurent = DCount("ContactID", "tblContactLocation", "(tblContactLocation.ContactID=" & [Forms]![frmContactNew]![ContactID] & ") And (tblContactLocation.ContactOfficeStatus = 'current')")

???
 
If you boys are ever in Washington DC, look me up, I'll buy you lunch.

I seriously mean that.
 
Last edited:
Hello Guys,

Ken, what do the "&"s do in that line?

And I see that the main problem I was having, I actually tried several different versions befor posting it here, was the use of single quotation marks for values.
Thanks
 
Hi Thales

As ContactID has number datatype so the ContactID(Form Control) starts with "& and ends with &" as the following line:

Code:
tblContactLocation.ContactID=" & [Forms]![frmContactNew]![ContactID] & "

If suppose it has text data type then it should have started with ' " & and ended with & " '
that means single quotes extra than number data type.

If it has Date datatype then there should be extra # around that rather than single quotes.

I hope its understood.

Cheers
 
I get it now, it differentiates between data type.
 
Between LITERAL datatypes in VBA or SQL.
 

Users who are viewing this thread

Back
Top Bottom