Report to PDF

G

Guest

Hi

I am trying to use the Report to PDF function by Stephen Leban. I've kind of
got it working but a few probs:

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume this
shouldn't crash?

2. a. I pass a date field for the path creation. I am having problems with
the date format, if I pass month([field]) it works ok taking the numerically
form but I want the month as text. strMonth = Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as I am
in the UK.
I have tried using the # literal character to change the formatting but this
just puts #January#. Can anyone please give me the correct syntax?

b. It seems as though the folder has to already exist in Windows for this to
work. I was hoping it would create the folder if it didn't exist - is this
possible?

Kind Regards

Sue
 
A

Alex Dybenko

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume this
shouldn't crash?

Have you tried Stephen sample, does it also crash?
2. a. I pass a date field for the path creation. I am having problems with
the date format, if I pass month([field]) it works ok taking the
numerically
form but I want the month as text. strMonth =
Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as I
am
in the UK.
I have tried using the # literal character to change the formatting but
this
just puts #January#. Can anyone please give me the correct syntax?

try Format([ReportingDate], "mmmm")
b. It seems as though the folder has to already exist in Windows for this
to
work. I was hoping it would create the folder if it didn't exist - is this
possible?

use MkDir


--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 
J

John Spencer

Have no idea on your first problem. Perhaps you would post it separately
along with any error messages you get.

2a. Format(ReportingDate,"mmmm") will return the month name. You were
returning the month name for the date value of 10 (Jaunuary 9, 1900).
2b. The directory must exist already. Look up MkDir in the VBA help to see
how to create a directory. Look up DIR to see how to check for the
existence of the directory.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
G

Guest

Thanks Alex/John for your replies. I didn't spot the format error, removed
the Month and all works as expected :). I will have a look at the DIR
functions.

I will post the Stephen Lebans part again thanks. Stephens sample does work
ok so it must be something I'm missing. The problem is his version loads the
created pdf in Adobe, mine tries but just crashes Access and does a compact
and repair.

Thanks for your help.
Sue


John Spencer said:
Have no idea on your first problem. Perhaps you would post it separately
along with any error messages you get.

2a. Format(ReportingDate,"mmmm") will return the month name. You were
returning the month name for the date value of 10 (Jaunuary 9, 1900).
2b. The directory must exist already. Look up MkDir in the VBA help to see
how to create a directory. Look up DIR to see how to check for the
existence of the directory.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

hughess7 said:
Hi

I am trying to use the Report to PDF function by Stephen Leban. I've kind
of
got it working but a few probs:

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume this
shouldn't crash?

2. a. I pass a date field for the path creation. I am having problems with
the date format, if I pass month([field]) it works ok taking the
numerically
form but I want the month as text. strMonth =
Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as I
am
in the UK.
I have tried using the # literal character to change the formatting but
this
just puts #January#. Can anyone please give me the correct syntax?

b. It seems as though the folder has to already exist in Windows for this
to
work. I was hoping it would create the folder if it didn't exist - is this
possible?

Kind Regards

Sue
 
S

Stephen Lebans

There is no bug in that solution. You have a problem with your application
that displays PDF files. More than likely you are allowing illegal
characters in your filename and Adobe Reader(whatever) is choking on it.

There is parameter in the calling function that allows you to specify
whether or not your application currently registered to display PDF files is
called to open and display the newly created PDF.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


hughess7 said:
Thanks Alex/John for your replies. I didn't spot the format error, removed
the Month and all works as expected :). I will have a look at the DIR
functions.

I will post the Stephen Lebans part again thanks. Stephens sample does
work
ok so it must be something I'm missing. The problem is his version loads
the
created pdf in Adobe, mine tries but just crashes Access and does a
compact
and repair.

Thanks for your help.
Sue


John Spencer said:
Have no idea on your first problem. Perhaps you would post it separately
along with any error messages you get.

2a. Format(ReportingDate,"mmmm") will return the month name. You were
returning the month name for the date value of 10 (Jaunuary 9, 1900).
2b. The directory must exist already. Look up MkDir in the VBA help to
see
how to create a directory. Look up DIR to see how to check for the
existence of the directory.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

hughess7 said:
Hi

I am trying to use the Report to PDF function by Stephen Leban. I've
kind
of
got it working but a few probs:

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume
this
shouldn't crash?

2. a. I pass a date field for the path creation. I am having problems
with
the date format, if I pass month([field]) it works ok taking the
numerically
form but I want the month as text. strMonth =
Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as
I
am
in the UK.
I have tried using the # literal character to change the formatting but
this
just puts #January#. Can anyone please give me the correct syntax?

b. It seems as though the folder has to already exist in Windows for
this
to
work. I was hoping it would create the folder if it didn't exist - is
this
possible?

Kind Regards

Sue
 
G

Guest

Filename is just firstname surname so no illegal characters unless a space is
illegal. I have copied your code and modified it to a specific report and
location/filename. I wondered if I had not copied some of your code I needed
but the only bits I think I missed are the form_open and double_click code as
these aren't required for my app.

I guess I'll try to find the reference to the parameter and stop Adobe from
trying to open the PDF and see if this then prevents the crash. My coding is
very basic.

Thanks
Sue


Stephen Lebans said:
There is no bug in that solution. You have a problem with your application
that displays PDF files. More than likely you are allowing illegal
characters in your filename and Adobe Reader(whatever) is choking on it.

There is parameter in the calling function that allows you to specify
whether or not your application currently registered to display PDF files is
called to open and display the newly created PDF.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


hughess7 said:
Thanks Alex/John for your replies. I didn't spot the format error, removed
the Month and all works as expected :). I will have a look at the DIR
functions.

I will post the Stephen Lebans part again thanks. Stephens sample does
work
ok so it must be something I'm missing. The problem is his version loads
the
created pdf in Adobe, mine tries but just crashes Access and does a
compact
and repair.

Thanks for your help.
Sue


John Spencer said:
Have no idea on your first problem. Perhaps you would post it separately
along with any error messages you get.

2a. Format(ReportingDate,"mmmm") will return the month name. You were
returning the month name for the date value of 10 (Jaunuary 9, 1900).
2b. The directory must exist already. Look up MkDir in the VBA help to
see
how to create a directory. Look up DIR to see how to check for the
existence of the directory.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Hi

I am trying to use the Report to PDF function by Stephen Leban. I've
kind
of
got it working but a few probs:

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume
this
shouldn't crash?

2. a. I pass a date field for the path creation. I am having problems
with
the date format, if I pass month([field]) it works ok taking the
numerically
form but I want the month as text. strMonth =
Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as
I
am
in the UK.
I have tried using the # literal character to change the formatting but
this
just puts #January#. Can anyone please give me the correct syntax?

b. It seems as though the folder has to already exist in Windows for
this
to
work. I was hoping it would create the folder if it didn't exist - is
this
possible?

Kind Regards

Sue
 
G

Guest

I debugged the code and actually it doesn't quite get this far and the pdf
opening is a red herring. It is actually the lines before it that cause
Access to crash.

' Call our function in the StrStorage DLL
blRet = ConvertUncompressedSnapshot(mUncompressedSnapFile, sOutFile, 0, "",
"", 0)

strStorage.dll is in the windows\system32 folder

Thanks in advance for any help.
Sue


hughess7 said:
Filename is just firstname surname so no illegal characters unless a space is
illegal. I have copied your code and modified it to a specific report and
location/filename. I wondered if I had not copied some of your code I needed
but the only bits I think I missed are the form_open and double_click code as
these aren't required for my app.

I guess I'll try to find the reference to the parameter and stop Adobe from
trying to open the PDF and see if this then prevents the crash. My coding is
very basic.

Thanks
Sue


Stephen Lebans said:
There is no bug in that solution. You have a problem with your application
that displays PDF files. More than likely you are allowing illegal
characters in your filename and Adobe Reader(whatever) is choking on it.

There is parameter in the calling function that allows you to specify
whether or not your application currently registered to display PDF files is
called to open and display the newly created PDF.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


hughess7 said:
Thanks Alex/John for your replies. I didn't spot the format error, removed
the Month and all works as expected :). I will have a look at the DIR
functions.

I will post the Stephen Lebans part again thanks. Stephens sample does
work
ok so it must be something I'm missing. The problem is his version loads
the
created pdf in Adobe, mine tries but just crashes Access and does a
compact
and repair.

Thanks for your help.
Sue


:

Have no idea on your first problem. Perhaps you would post it separately
along with any error messages you get.

2a. Format(ReportingDate,"mmmm") will return the month name. You were
returning the month name for the date value of 10 (Jaunuary 9, 1900).
2b. The directory must exist already. Look up MkDir in the VBA help to
see
how to create a directory. Look up DIR to see how to check for the
existence of the directory.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Hi

I am trying to use the Report to PDF function by Stephen Leban. I've
kind
of
got it working but a few probs:

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume
this
shouldn't crash?

2. a. I pass a date field for the path creation. I am having problems
with
the date format, if I pass month([field]) it works ok taking the
numerically
form but I want the month as text. strMonth =
Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as
I
am
in the UK.
I have tried using the # literal character to change the formatting but
this
just puts #January#. Can anyone please give me the correct syntax?

b. It seems as though the folder has to already exist in Windows for
this
to
work. I was hoping it would create the folder if it didn't exist - is
this
possible?

Kind Regards

Sue
 
G

Guest

For reference, commenting out the line:
blRet = ConvertUncompressedSnapshot(mUncompressedSnapFile, sOutFile, 0, "",

stops Access from crashing and Adobe loads the PDF.

Hopefully it is ok like this?
Thanks
Sue


hughess7 said:
I debugged the code and actually it doesn't quite get this far and the pdf
opening is a red herring. It is actually the lines before it that cause
Access to crash.

' Call our function in the StrStorage DLL
blRet = ConvertUncompressedSnapshot(mUncompressedSnapFile, sOutFile, 0, "",
"", 0)

strStorage.dll is in the windows\system32 folder

Thanks in advance for any help.
Sue


hughess7 said:
Filename is just firstname surname so no illegal characters unless a space is
illegal. I have copied your code and modified it to a specific report and
location/filename. I wondered if I had not copied some of your code I needed
but the only bits I think I missed are the form_open and double_click code as
these aren't required for my app.

I guess I'll try to find the reference to the parameter and stop Adobe from
trying to open the PDF and see if this then prevents the crash. My coding is
very basic.

Thanks
Sue


Stephen Lebans said:
There is no bug in that solution. You have a problem with your application
that displays PDF files. More than likely you are allowing illegal
characters in your filename and Adobe Reader(whatever) is choking on it.

There is parameter in the calling function that allows you to specify
whether or not your application currently registered to display PDF files is
called to open and display the newly created PDF.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Thanks Alex/John for your replies. I didn't spot the format error, removed
the Month and all works as expected :). I will have a look at the DIR
functions.

I will post the Stephen Lebans part again thanks. Stephens sample does
work
ok so it must be something I'm missing. The problem is his version loads
the
created pdf in Adobe, mine tries but just crashes Access and does a
compact
and repair.

Thanks for your help.
Sue


:

Have no idea on your first problem. Perhaps you would post it separately
along with any error messages you get.

2a. Format(ReportingDate,"mmmm") will return the month name. You were
returning the month name for the date value of 10 (Jaunuary 9, 1900).
2b. The directory must exist already. Look up MkDir in the VBA help to
see
how to create a directory. Look up DIR to see how to check for the
existence of the directory.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Hi

I am trying to use the Report to PDF function by Stephen Leban. I've
kind
of
got it working but a few probs:

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume
this
shouldn't crash?

2. a. I pass a date field for the path creation. I am having problems
with
the date format, if I pass month([field]) it works ok taking the
numerically
form but I want the month as text. strMonth =
Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as
I
am
in the UK.
I have tried using the # literal character to change the formatting but
this
just puts #January#. Can anyone please give me the correct syntax?

b. It seems as though the folder has to already exist in Windows for
this
to
work. I was hoping it would create the folder if it didn't exist - is
this
possible?

Kind Regards

Sue
 
G

Guest

Ah no it doesn't, PDF now not created it was old version I was seeing before
:-(

Thanks in advance for any help.
Sue


hughess7 said:
I debugged the code and actually it doesn't quite get this far and the pdf
opening is a red herring. It is actually the lines before it that cause
Access to crash.

' Call our function in the StrStorage DLL
blRet = ConvertUncompressedSnapshot(mUncompressedSnapFile, sOutFile, 0, "",
"", 0)

strStorage.dll is in the windows\system32 folder

Thanks in advance for any help.
Sue


hughess7 said:
Filename is just firstname surname so no illegal characters unless a space is
illegal. I have copied your code and modified it to a specific report and
location/filename. I wondered if I had not copied some of your code I needed
but the only bits I think I missed are the form_open and double_click code as
these aren't required for my app.

I guess I'll try to find the reference to the parameter and stop Adobe from
trying to open the PDF and see if this then prevents the crash. My coding is
very basic.

Thanks
Sue


Stephen Lebans said:
There is no bug in that solution. You have a problem with your application
that displays PDF files. More than likely you are allowing illegal
characters in your filename and Adobe Reader(whatever) is choking on it.

There is parameter in the calling function that allows you to specify
whether or not your application currently registered to display PDF files is
called to open and display the newly created PDF.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Thanks Alex/John for your replies. I didn't spot the format error, removed
the Month and all works as expected :). I will have a look at the DIR
functions.

I will post the Stephen Lebans part again thanks. Stephens sample does
work
ok so it must be something I'm missing. The problem is his version loads
the
created pdf in Adobe, mine tries but just crashes Access and does a
compact
and repair.

Thanks for your help.
Sue


:

Have no idea on your first problem. Perhaps you would post it separately
along with any error messages you get.

2a. Format(ReportingDate,"mmmm") will return the month name. You were
returning the month name for the date value of 10 (Jaunuary 9, 1900).
2b. The directory must exist already. Look up MkDir in the VBA help to
see
how to create a directory. Look up DIR to see how to check for the
existence of the directory.


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Hi

I am trying to use the Report to PDF function by Stephen Leban. I've
kind
of
got it working but a few probs:

1. The system produces the PDF in the correct path and filename but it
crashes Access every time after creation. I use Access 2003, I assume
this
shouldn't crash?

2. a. I pass a date field for the path creation. I am having problems
with
the date format, if I pass month([field]) it works ok taking the
numerically
form but I want the month as text. strMonth =
Format(month([ReportingDate]),
"mmmm") assumes January (the date is 01/09/07) instead of September as
I
am
in the UK.
I have tried using the # literal character to change the formatting but
this
just puts #January#. Can anyone please give me the correct syntax?

b. It seems as though the folder has to already exist in Windows for
this
to
work. I was hoping it would create the folder if it didn't exist - is
this
possible?

Kind Regards

Sue
 
T

Tony Toews [MVP]

hughess7 said:
I debugged the code and actually it doesn't quite get this far and the pdf
opening is a red herring. It is actually the lines before it that cause
Access to crash.

' Call our function in the StrStorage DLL
blRet = ConvertUncompressedSnapshot(mUncompressedSnapFile, sOutFile, 0, "",
"", 0)

strStorage.dll is in the windows\system32 folder

Those DLLs should be in the same folder as your FE.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
G

Guest

Hi Tony

Thanks but Stephens stuff says either that or system32. I tried just in case
putting a copy with the FE but Access still crashing after creating the PDF
:-(

Sue
 
T

Tony Toews [MVP]

hughess7 said:
Thanks but Stephens stuff says either that or system32. I tried just in case
putting a copy with the FE but Access still crashing after creating the PDF
:-(

Ah, I missed that in the instructions. I put them in the FE folder so
as to minimize version problems.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 

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

Top