471,066 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,066 software developers and data experts.

can someone tell me what I am missing with strings

ok I was trying to do something real simple I thought
Me.Clinic.DefaultValue = Me.Clinic.Value

I got error either ! or . misused or not found...something like that I
thought ok how can you not find the variable that this field is tied
to.
ok it takes a variant so maybe its
Me.Clinic.DefaultValue = Me.[Clinic].Value

no thats not it so I just tried everything then someone said no do
this

Me.Clinic.DefaultValue = CStr("""" & Me.Clinic.Value & """")

well this works but what I can NOT get thru my head is why doe you
have to have 4 " ???

explaining it to me won't work...where can I go read about these types
of things so I can get them thru my thick head?

its like a thing I did once for school it was getting data into a
database from a web page

simple=====

string sCommand = "INSERT INTO tblAgreement(ContractNumber, ExpDate,
Status, Allowed) VALUES (" + ContractNumber +",'" + ExpDate + "','" +
Status.ToString() + "'," + Allowed.ToString() + ");"

but it took me 2 days to get it right....AHHHHHHHH I can't get these
parsers and stuff

thanks for any help

Jerry

Nov 13 '05 #1
2 1614
sparks wrote:
ok I was trying to do something real simple I thought
Me.Clinic.DefaultValue = Me.Clinic.Value

I got error either ! or . misused or not found...something like that I
thought ok how can you not find the variable that this field is tied
to.
ok it takes a variant so maybe its
Me.Clinic.DefaultValue = Me.[Clinic].Value

no thats not it so I just tried everything then someone said no do
this

Me.Clinic.DefaultValue = CStr("""" & Me.Clinic.Value & """")

well this works but what I can NOT get thru my head is why doe you
have to have 4 " ???
From A97 Help topic "Quotation Marks In Strings"
Include Double Quotation Marks

You should include double quotation marks within the criteria argument
in such a way so that when the value of the variable is evaluated, it
will be enclosed within the quotation marks. Within a string, you must
use two sets of double quotation marks to represent a single set of
double quotation marks. You could construct the criteria argument as in
the following example:

"[LastName] = """ & strName & """"

When the variable strName is evaluated and concatenated into the
criteria argument, each set of two double quotation marks is replaced by
one single quotation mark. The criteria argument becomes:

"[LastName] = 'Smith'"

*******
Note: The above is an error in MS Help. Access does not change double
quotes into single quotes. It would be "[LastName] = "Smith""
*******

This syntax may appear more complicated than the single quotation mark
syntax, but it enables you to embed a string that contains an apostrophe
within the criteria argument. It also enables you to nest one or more
strings within the embedded string.

Include a Variable Representing Quotation Marks

You can create a string variable that represents double quotation marks,
and concatenate this variable into the criteria argument along with the
value of the variable. The ANSI representation for double quotation
marks is Chr$(34); you could assign this value to a string variable
called strQuote. You could then construct the criteria argument as in
the following example:

"[LastName] = " & strQuote & strName & strQuote

When the variables are evaluated and concatenated into the criteria
argument, the criteria argument becomes:

"[LastName] = "Smith""
explaining it to me won't work...where can I go read about these types
of things so I can get them thru my thick head?

its like a thing I did once for school it was getting data into a
database from a web page

simple=====

string sCommand = "INSERT INTO tblAgreement(ContractNumber, ExpDate,
Status, Allowed) VALUES (" + ContractNumber +",'" + ExpDate + "','" +
Status.ToString() + "'," + Allowed.ToString() + ");"

but it took me 2 days to get it right....AHHHHHHHH I can't get these
parsers and stuff

But didn't you feel better when you got it working?


thanks for any help

Jerry

Nov 13 '05 #2
I guess its what I am seeing here
CStr("""" & Me.Clinic.Value & """")

this looks to me like it should be """ & Me.Clinic.Value & """
why the extra "

if you have to put the " in quotes why do you have to put 2 sets of
quotes?

Jerry

On Wed, 31 Aug 2005 14:17:15 GMT, Salad <oi*@vinegar.com> wrote:
sparks wrote:
ok I was trying to do something real simple I thought
Me.Clinic.DefaultValue = Me.Clinic.Value

I got error either ! or . misused or not found...something like that I
thought ok how can you not find the variable that this field is tied
to.
ok it takes a variant so maybe its
Me.Clinic.DefaultValue = Me.[Clinic].Value

no thats not it so I just tried everything then someone said no do
this

Me.Clinic.DefaultValue = CStr("""" & Me.Clinic.Value & """")

well this works but what I can NOT get thru my head is why doe you
have to have 4 " ???


From A97 Help topic "Quotation Marks In Strings"
Include Double Quotation Marks

You should include double quotation marks within the criteria argument
in such a way so that when the value of the variable is evaluated, it
will be enclosed within the quotation marks. Within a string, you must
use two sets of double quotation marks to represent a single set of
double quotation marks. You could construct the criteria argument as in
the following example:

"[LastName] = """ & strName & """"

When the variable strName is evaluated and concatenated into the
criteria argument, each set of two double quotation marks is replaced by
one single quotation mark. The criteria argument becomes:

"[LastName] = 'Smith'"

*******
Note: The above is an error in MS Help. Access does not change double
quotes into single quotes. It would be "[LastName] = "Smith""
*******

This syntax may appear more complicated than the single quotation mark
syntax, but it enables you to embed a string that contains an apostrophe
within the criteria argument. It also enables you to nest one or more
strings within the embedded string.

Include a Variable Representing Quotation Marks

You can create a string variable that represents double quotation marks,
and concatenate this variable into the criteria argument along with the
value of the variable. The ANSI representation for double quotation
marks is Chr$(34); you could assign this value to a string variable
called strQuote. You could then construct the criteria argument as in
the following example:

"[LastName] = " & strQuote & strName & strQuote

When the variables are evaluated and concatenated into the criteria
argument, the criteria argument becomes:

"[LastName] = "Smith""

explaining it to me won't work...where can I go read about these types
of things so I can get them thru my thick head?

its like a thing I did once for school it was getting data into a
database from a web page

simple=====

string sCommand = "INSERT INTO tblAgreement(ContractNumber, ExpDate,
Status, Allowed) VALUES (" + ContractNumber +",'" + ExpDate + "','" +
Status.ToString() + "'," + Allowed.ToString() + ");"

but it took me 2 days to get it right....AHHHHHHHH I can't get these
parsers and stuff


But didn't you feel better when you got it working?


thanks for any help

Jerry


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by greenflame | last post: by
6 posts views Thread by Helmut Giese | last post: by
15 posts views Thread by Walter Dnes (delete the 'z' to get my real address | last post: by
1 post views Thread by Henry Stock | last post: by
1 post views Thread by jazzMan007 | last post: by
2 posts views Thread by William Morgan | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.