A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

syntax



 
 
Thread Tools Display Modes
  #1  
Old June 25th, 2004, 01:47 PM
mia_placidus
external usenet poster
 
Posts: n/a
Default syntax

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?
  #2  
Old June 25th, 2004, 02:08 PM
external usenet poster
 
Posts: n/a
Default syntax

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.


-----Original 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?
.

  #3  
Old June 25th, 2004, 02:09 PM
Dan Artuso
external usenet poster
 
Posts: n/a
Default syntax

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

HTH
Dan Artuso, MVP

"mia_placidus" 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?



  #4  
Old June 25th, 2004, 03:47 PM
Mia_placidus
external usenet poster
 
Posts: n/a
Default syntax

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" 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?



.

  #5  
Old June 25th, 2004, 04:20 PM
Dan Artuso
external usenet poster
 
Posts: n/a
Default syntax

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" wrote in message ...
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" 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?



.



  #6  
Old June 25th, 2004, 06:30 PM
miaplacidus
external usenet poster
 
Posts: n/a
Default syntax

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


"Mia_placidus" wrote in message

...
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" 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?


.



.

  #7  
Old June 25th, 2004, 07:59 PM
Dan Artuso
external usenet poster
 
Posts: n/a
Default syntax

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" wrote in message ...
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


"Mia_placidus" wrote in message

...
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" 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?


.



.



  #8  
Old June 29th, 2004, 09:14 PM
miaplacidus
external usenet poster
 
Posts: n/a
Default syntax

Your argument makes sense. I think part of my trouble was
that if I used MsgBox to evaluate the string variable I
got one answer, but if I used the inspector feature in the
visual basic editor I got a different answer. Also when I
put the [FilesAs] in then a whole new set of errors was
generated, depending on how the quotes were used.

-----Original Message-----
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" wrote in message

...
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


"Mia_placidus" wrote in

message
...
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" 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?


.



.



.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax to run PL/SQL stored proc via ms access pass through query Edwinah63 General Discussion 2 June 23rd, 2004 03:47 AM
Source Data Syntax George Wilson Charts and Charting 1 June 8th, 2004 01:20 AM
Open.text macro fn syntax cuckoonuck Worksheet Functions 1 May 30th, 2004 03:09 AM
Syntax of excel Tapani Tuominen Worksheet Functions 2 March 30th, 2004 09:12 PM
Syntax Help with IF/AND Statement Niek Otten Worksheet Functions 4 March 23rd, 2004 03:28 PM


All times are GMT +1. The time now is 06:33 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.