Syntax of quotes?

J

Jack Isaacs

Hello All

I have a procedure Jmail that sends a specified file by email. It works fine
normally. But when I want to include in the filename a value from the
current form, I can't get it to work.
i.e. when the parameter is

"\\server\pdocprogrammes\client_reports\gp1 complete all.pdf"

it works, but when I need to add [forms]![frm x main]![month name] to the
file name I tried:

"""\\server\pdocprogrammes\client_reports\gp1 complete all"" & [forms]!frm x
main]![month name]&"".pdf"""
(i.e. double quotes round the two 'hard-coded' elements
""\\server\pdocprogrammes\client_reports\gp1 complete all"" and "".pdf"")
but this didn't work, and neither did

"drName & flName & .pdf"
where drName and flName have previously been defined (see complete code
below)

I'm sure this is just about having the right number of quotes (and/or single
quotes?), but I've tried every combination I can think of and can't get it
to work!!!

Hope someone can help
Many thanks
Les
__________________________________________
The code

Private Sub Command0_Click()

Dim rptName As String
Dim flName As String
Dim drName As String
Dim strName As String

drName = "\\server\pdoc programmes\client_reports\"
rptName = "gp1 complete all"
flName = "gp1 complete all - " & [Forms]![frm x main]![month name]
strName = "test"

'sHandlePDF rptName, flName, drName, strName
ConvertReportToPDF rptName, vbNullString, drName & flName & ".pdf", False

'This works fine:
SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
"\\server\pdocprogrammes\client_reports\gp1 complete all.pdf"

'But this does NOT work:
SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
"drName & flName & .pdf"

End Sub
 
D

Dirk Goldgar

In
Jack Isaacs said:
'But this does NOT work:
SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many
thanks.", "drName & flName & .pdf"

Try this:

SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc", _
"Please find attached LP11s for the GP Practices detailed. " & _
"Many thanks.", _
drName & flName & ".pdf"
 
J

Jack Isaacs

Dirk

I thought it might be something simple - but not that simple!!
Your suggestion worked perefctly.
Somehow I had thought that all the parameters of the SendJmail function
needed to be enclosed in quotes: obviously not!

Many thanks for your help.
Les
 
D

Dirk Goldgar

In
Jack Isaacs said:
Dirk

I thought it might be something simple - but not that simple!!
Your suggestion worked perefctly.
Somehow I had thought that all the parameters of the SendJmail
function needed to be enclosed in quotes: obviously not!

They're strings. If you provide a string literal, it has to be enclosed
in quotes. If you already have some of the values in string variables,
you just have supply an expression that concatenates those variables
with string literals to return a string value.
Many thanks for your help.

You're welcome.
 
Y

Yanick

Hi Jack,

Try this:

SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
drName & flName & ".pdf"

Since drName & flName are declare as String, you don't need the quote before
and after them.

Yanick
 
P

Paolo

Hi Jack,

Try this:

"\\server\pdocprogrammes\client_reports\gp1 complete all" & [forms]![frm x
main]![month name] &".pdf"

And be sure to put a bracket before [frm x main] ' cause in your string is
missing and is required.

the code at the bottom of your post doesn't work 'cause you mustn't put the
variables between quotes. try this

"Please find attached LP11s for the GP Practices detailed. Many thanks.",
drName & flName & ".pdf"

HTH Paolo
 
J

Jack Isaacs

Yanick

Thanks for your reply - which worked!
In fact Dirk had also suggested the same.

Thanks again
Les


Yanick said:
Hi Jack,

Try this:

SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
drName & flName & ".pdf"

Since drName & flName are declare as String, you don't need the quote
before
and after them.

Yanick

Jack Isaacs said:
Hello All

I have a procedure Jmail that sends a specified file by email. It works
fine
normally. But when I want to include in the filename a value from the
current form, I can't get it to work.
i.e. when the parameter is

"\\server\pdocprogrammes\client_reports\gp1 complete all.pdf"

it works, but when I need to add [forms]![frm x main]![month name] to the
file name I tried:

"""\\server\pdocprogrammes\client_reports\gp1 complete all"" &
[forms]!frm x
main]![month name]&"".pdf"""
(i.e. double quotes round the two 'hard-coded' elements
""\\server\pdocprogrammes\client_reports\gp1 complete all"" and "".pdf"")
but this didn't work, and neither did

"drName & flName & .pdf"
where drName and flName have previously been defined (see complete code
below)

I'm sure this is just about having the right number of quotes (and/or
single
quotes?), but I've tried every combination I can think of and can't get
it
to work!!!

Hope someone can help
Many thanks
Les
__________________________________________
The code

Private Sub Command0_Click()

Dim rptName As String
Dim flName As String
Dim drName As String
Dim strName As String

drName = "\\server\pdoc programmes\client_reports\"
rptName = "gp1 complete all"
flName = "gp1 complete all - " & [Forms]![frm x main]![month name]
strName = "test"

'sHandlePDF rptName, flName, drName, strName
ConvertReportToPDF rptName, vbNullString, drName & flName & ".pdf", False

'This works fine:
SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
"\\server\pdocprogrammes\client_reports\gp1 complete all.pdf"

'But this does NOT work:
SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
"drName & flName & .pdf"

End Sub
 
J

Jack Isaacs

Paolo

Thanks for your reply - which worked!
In fact Dirk had also suggested the same.

Thanks again
Les


Paolo said:
Hi Jack,

Try this:

"\\server\pdocprogrammes\client_reports\gp1 complete all" & [forms]![frm x
main]![month name] &".pdf"

And be sure to put a bracket before [frm x main] ' cause in your string is
missing and is required.

the code at the bottom of your post doesn't work 'cause you mustn't put
the
variables between quotes. try this

"Please find attached LP11s for the GP Practices detailed. Many thanks.",
drName & flName & ".pdf"

HTH Paolo

Jack Isaacs said:
Hello All

I have a procedure Jmail that sends a specified file by email. It works
fine
normally. But when I want to include in the filename a value from the
current form, I can't get it to work.
i.e. when the parameter is

"\\server\pdocprogrammes\client_reports\gp1 complete all.pdf"

it works, but when I need to add [forms]![frm x main]![month name] to the
file name I tried:

"""\\server\pdocprogrammes\client_reports\gp1 complete all"" &
[forms]!frm x
main]![month name]&"".pdf"""
(i.e. double quotes round the two 'hard-coded' elements
""\\server\pdocprogrammes\client_reports\gp1 complete all"" and "".pdf"")
but this didn't work, and neither did

"drName & flName & .pdf"
where drName and flName have previously been defined (see complete code
below)

I'm sure this is just about having the right number of quotes (and/or
single
quotes?), but I've tried every combination I can think of and can't get
it
to work!!!

Hope someone can help
Many thanks
Les
__________________________________________
The code

Private Sub Command0_Click()

Dim rptName As String
Dim flName As String
Dim drName As String
Dim strName As String

drName = "\\server\pdoc programmes\client_reports\"
rptName = "gp1 complete all"
flName = "gp1 complete all - " & [Forms]![frm x main]![month name]
strName = "test"

'sHandlePDF rptName, flName, drName, strName
ConvertReportToPDF rptName, vbNullString, drName & flName & ".pdf", False

'This works fine:
SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
"\\server\pdocprogrammes\client_reports\gp1 complete all.pdf"

'But this does NOT work:
SendJmail "(e-mail address removed)", _
"", "(e-mail address removed)", "LP11s from PayeDoc",
"Please find attached LP11s for the GP Practices detailed. Many thanks.",
"drName & flName & .pdf"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Avoiding repeated conditions? 6
Too few parameters? 11
Creating a function? 16

Top