syntax

  • Thread starter Thread starter mia_placidus
  • Start date Start date
M

mia_placidus

I have the following expression:

strName = """[FileAs] = """ & strLastName & ", " &
strFirstName & """""" & """"

It Evaluates to: "[FileAs]= "Lee, Larry"""

It Should Evaluate to "[FileAs] = ""Lee, Larry"""

When I try to get the extra quotation mark in front of
Lee, then I get an error message on the comma that
says "Expected end of Statement"

This is confusing, any help?
 
OK, I got strName to evaluate properly. Now I have the
following statement:

Set objContact = objContacts.Items.Find(strName)

This statement generates an error message. However, if I
type in "[FileAs] = ""Lee, Larry""" between the parens,
then it works.

AARGGH.
 
Hi,
Try this:
strName = """[FileAs] = """"" & strLAstName & ", " & strFirstName & """"""

HTH
Dan Artuso, MVP
 
That appears to evaluate OK, when viewed in the message
box. However, it generates an error when it tries to do an
item.find that says: Unable to parse condition. Error
at ""[FileAs]= ""Lee, Larry"".

Note that this show two sets of quotes in front of [FileAs]
and two sets after Larry, while wat works is one set
before [FileAs], two sets befor Lee, and three sets after
Larry. If I get one that appears to evaluate properly in
the message box it generates an error that says: Condition
not valid. Yet if I just type it in, then it works.

This is kind of like a self-starter that you have to crank!
-----Original Message-----
Hi,
Try this:
strName = """[FileAs] = """"" & strLAstName & ", " & strFirstName & """"""

HTH
Dan Artuso, MVP

I have the following expression:

strName = """[FileAs] = """ & strLastName & ", " &
strFirstName & """""" & """"

It Evaluates to: "[FileAs]= "Lee, Larry"""

It Should Evaluate to "[FileAs] = ""Lee, Larry"""

When I try to get the extra quotation mark in front of
Lee, then I get an error message on the comma that
says "Expected end of Statement"

This is confusing, any help?


.
 
Hi,
Are you sure you have to worry about the beginning and ending quotes in the first place?
I would think this would work:
strName = "[FileAs] = """ & strLAstName & ", " & strFirstName & """"


HTH
Dan Artuso


Mia_placidus said:
That appears to evaluate OK, when viewed in the message
box. However, it generates an error when it tries to do an
item.find that says: Unable to parse condition. Error
at ""[FileAs]= ""Lee, Larry"".

Note that this show two sets of quotes in front of [FileAs]
and two sets after Larry, while wat works is one set
before [FileAs], two sets befor Lee, and three sets after
Larry. If I get one that appears to evaluate properly in
the message box it generates an error that says: Condition
not valid. Yet if I just type it in, then it works.

This is kind of like a self-starter that you have to crank!
-----Original Message-----
Hi,
Try this:
strName = """[FileAs] = """"" & strLAstName & ", " & strFirstName & """"""

HTH
Dan Artuso, MVP

I have the following expression:

strName = """[FileAs] = """ & strLastName & ", " &
strFirstName & """""" & """"

It Evaluates to: "[FileAs]= "Lee, Larry"""

It Should Evaluate to "[FileAs] = ""Lee, Larry"""

When I try to get the extra quotation mark in front of
Lee, then I get an error message on the comma that
says "Expected end of Statement"

This is confusing, any help?


.
 
That worked. Now I'd like to know how you figured that out.
I thought I had tried every permutation.

I took the original code from a sample or example. I knew
it was sensitive to the marks because depending on which
ones you leave out you get various errors. One at the
beginning, two in the middle and three at the end was what
was in the sample and that's what worked.

When I tried to generalize the code and pick up the names
from another source was when I had a problem.

I hate it when something works and I don't know why.

Thank You
-----Original Message-----
Hi,
Are you sure you have to worry about the beginning and
ending quotes in the first place?
I would think this would work:
strName = "[FileAs] = """ & strLAstName & ", " & strFirstName & """"


HTH
Dan Artuso


That appears to evaluate OK, when viewed in the message
box. However, it generates an error when it tries to do an
item.find that says: Unable to parse condition. Error
at ""[FileAs]= ""Lee, Larry"".

Note that this show two sets of quotes in front of [FileAs]
and two sets after Larry, while wat works is one set
before [FileAs], two sets befor Lee, and three sets after
Larry. If I get one that appears to evaluate properly in
the message box it generates an error that says: Condition
not valid. Yet if I just type it in, then it works.

This is kind of like a self-starter that you have to crank!
-----Original Message-----
Hi,
Try this:
strName = """[FileAs] = """"" & strLAstName & ", " & strFirstName & """"""

HTH
Dan Artuso, MVP

"mia_placidus" <[email protected]> wrote in
message
I have the following expression:

strName = """[FileAs] = """ & strLastName & ", " &
strFirstName & """""" & """"

It Evaluates to: "[FileAs]= "Lee, Larry"""

It Should Evaluate to "[FileAs] = ""Lee, Larry"""

When I try to get the extra quotation mark in front of
Lee, then I get an error message on the comma that
says "Expected end of Statement"

This is confusing, any help?


.


.
 
Hi,
The function expects a string as an argument.
If I have a string variable, I don't need any 'extra' quotes.
Quotes are simply delimiters that allow things to be parsed and to tell Access where the
string starts and where it ends.
Example:

str = "hi there"
call MyFunc(str)

In other words I don't need this:
str = """hi there"""

str does not have to evaluate to:
"hi there"

Now, you do need the quotes around criteria that is a string, so those I added.
Does that make sense?

Dan Artuso, MVP

miaplacidus said:
That worked. Now I'd like to know how you figured that out.
I thought I had tried every permutation.

I took the original code from a sample or example. I knew
it was sensitive to the marks because depending on which
ones you leave out you get various errors. One at the
beginning, two in the middle and three at the end was what
was in the sample and that's what worked.

When I tried to generalize the code and pick up the names
from another source was when I had a problem.

I hate it when something works and I don't know why.

Thank You
-----Original Message-----
Hi,
Are you sure you have to worry about the beginning and
ending quotes in the first place?
I would think this would work:
strName = "[FileAs] = """ & strLAstName & ", " & strFirstName & """"


HTH
Dan Artuso


That appears to evaluate OK, when viewed in the message
box. However, it generates an error when it tries to do an
item.find that says: Unable to parse condition. Error
at ""[FileAs]= ""Lee, Larry"".

Note that this show two sets of quotes in front of [FileAs]
and two sets after Larry, while wat works is one set
before [FileAs], two sets befor Lee, and three sets after
Larry. If I get one that appears to evaluate properly in
the message box it generates an error that says: Condition
not valid. Yet if I just type it in, then it works.

This is kind of like a self-starter that you have to crank!

-----Original Message-----
Hi,
Try this:
strName = """[FileAs] = """"" & strLAstName & ", " &
strFirstName & """"""

HTH
Dan Artuso, MVP

I have the following expression:

strName = """[FileAs] = """ & strLastName & ", " &
strFirstName & """""" & """"

It Evaluates to: "[FileAs]= "Lee, Larry"""

It Should Evaluate to "[FileAs] = ""Lee, Larry"""

When I try to get the extra quotation mark in front of
Lee, then I get an error message on the comma that
says "Expected end of Statement"

This is confusing, any help?


.


.
 
Back
Top