UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Why ? Is This Correct, Access 2016    
 
   
access2009eg
post Jan 16 2020, 10:58 AM
Post#1



Posts: 1,150
Joined: 19-February 08



Hellow friends
I search using google about Dcount
I find this expression
MsgBox DCount("ClientName", "Clients", "[ClientName]= '" & Forms!form2!Text0 & "' ")
\\\\\\\\\\\\\\\
but not work
\\\\\\\\\\\\\\\\\

I replace the Double " with ' single and work
why

MsgBox DCount("ClientName", "Clients", "[ClientName]= ' ' & Forms!form2!Text0 & ' ' ")

office 2016

Thank you

--------------------
I would like to Thank you for your help
Go to the top of the page
 
theDBguy
post Jan 16 2020, 11:26 AM
Post#2


UA Moderator
Posts: 77,304
Joined: 19-June 07
From: SunnySandyEggo


Can you post a sample/test database for verification?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
kfield7
post Jan 16 2020, 02:57 PM
Post#3



Posts: 1,031
Joined: 12-November 03
From: Iowa Lot


It looks like you have an extra space in the first example
& "' "
& "'"

The second example doesn't look like it should work at all.

You are testing ClientName against the contents of Text0, which will have a string value, e.g., "abc"
Since abc is a string it needs to be enclosed in " or ', but the criteria itself is a string enclosed in ", so you need to use '.

[ClientName] = 'abc'

broken out:

"[ClientName] = " & "'" & [your string value] & "'"

or


"[ClientName] = '" & [your string value] & "'"
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    20th January 2020 - 09:59 PM