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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

PDF name from Field (2)



 
 
Thread Tools Display Modes
  #1  
Old February 10th, 2009, 02:05 AM posted to microsoft.public.access.tablesdbdesign
Brian Carlson
external usenet poster
 
Posts: 49
Default PDF name from Field (2)

I was reading a previous post on this subject, but it appears this post has
went cold. In either case, I would like to print/save a form and/or report
to a pdf with the file name being determined by a field value. Does anyone
know how to automate this? In the previous post, 'Brian' gave a rough way to
do this, but I was wondering if anyone know an alternative method or could
give a clear explanation of the one 'Brian' provided. A second semi-related
question, I would like to have a print button on a form that when clicked
prints its related report. This related report is on a parameter query and
therefore I need to pull the value from the current report enter it as the
parameter and also ensure that the information on the form has already been
updated in the table and thereby is available to the report...any ideas.
Thanks in advance for the help.

Brian
  #2  
Old February 11th, 2009, 12:35 AM posted to microsoft.public.access.tablesdbdesign
Dale Fye
external usenet poster
 
Posts: 2,651
Default PDF name from Field (2)

Brian,

I may have been involved in that earlier thread (How many records in a
filtered report - 2/2/09 in the Reports newsgroup).

The method that was suggested by Albert Kallal worked like a charm. I had a
button on my form, which opened the report in PrintPreview mode, and with
the help of his recommendations, I was able to change the caption of the
report based on the value of a field in the report, and then use the
SendObject method to send that report, with the new caption as the file
name.

It looks something like:

Private sub cmd_SendReport_Click

Dim strReport as string

strReport = "rpt_ReportName"
docmd.openreport strReport, acViewPreview,, "ID = " & me.ID
Reports(strReport).Caption = "Invoice ref: " & me!InvoiceNum
Docmd.SendObject acSendReport, strReport, acFormatPDF,

Docmd.close acReport, strReport

End Sub

Your challenge may be that you want this report to be based on a parameter
query. Can you post the SQL so I can make some recommendations on how to
get around this? One way might be to point the parameter to a textbox on a
form. Another might be to save the parameter value in a function, which
could be used as the parameter query. Another way would be to create the
report without the parameter, and pass the parameter in the Where clause in
the OpenReport method (like I did above).

HTH
Dale

"Brian Carlson" wrote in message
...
I was reading a previous post on this subject, but it appears this post has
went cold. In either case, I would like to print/save a form and/or
report
to a pdf with the file name being determined by a field value. Does
anyone
know how to automate this? In the previous post, 'Brian' gave a rough way
to
do this, but I was wondering if anyone know an alternative method or could
give a clear explanation of the one 'Brian' provided. A second
semi-related
question, I would like to have a print button on a form that when clicked
prints its related report. This related report is on a parameter query
and
therefore I need to pull the value from the current report enter it as the
parameter and also ensure that the information on the form has already
been
updated in the table and thereby is available to the report...any ideas.
Thanks in advance for the help.

Brian



  #3  
Old February 11th, 2009, 02:09 AM posted to microsoft.public.access.tablesdbdesign
Brian Carlson
external usenet poster
 
Posts: 49
Default PDF name from Field (2)

Dale:

The earlier thread that I was referring to was actually called 'pdf name
from field'. In either case, I was hoping to figure out a method to use this
procedure to print forms and print reports that are based on parameter
queries. I do not know if this is to vague to garner any help. In either
case, the SQL is:

SELECT t_A1B.A1B_ID, t_A1B.RE, t_A1B.Observers, t_A1B.Workdate,
t_A1B.AMTime, t_A1B.AMWeather, t_A1B.AmTemperature, t_A1B.PMTime,
t_A1B.PMWeather, t_A1B.PMTemperature, t_A1B.Visitors, t_A1B.Activities,
[Photos].[FileURL] AS Expr1, t_A1B.Photos
FROM t_A1B
WHERE (((t_A1B.Workdate)=[Enter Date]))
ORDER BY t_A1B.Workdate;

I simply cut and pasted this out of the query, though I do not really
understand it. If you are able to assist, please realize I am quite a novice
at this and may require more explanation than usual. Thank you in advance.

Brian

"Dale Fye" wrote:

Brian,

I may have been involved in that earlier thread (How many records in a
filtered report - 2/2/09 in the Reports newsgroup).

The method that was suggested by Albert Kallal worked like a charm. I had a
button on my form, which opened the report in PrintPreview mode, and with
the help of his recommendations, I was able to change the caption of the
report based on the value of a field in the report, and then use the
SendObject method to send that report, with the new caption as the file
name.

It looks something like:

Private sub cmd_SendReport_Click

Dim strReport as string

strReport = "rpt_ReportName"
docmd.openreport strReport, acViewPreview,, "ID = " & me.ID
Reports(strReport).Caption = "Invoice ref: " & me!InvoiceNum
Docmd.SendObject acSendReport, strReport, acFormatPDF,

Docmd.close acReport, strReport

End Sub

Your challenge may be that you want this report to be based on a parameter
query. Can you post the SQL so I can make some recommendations on how to
get around this? One way might be to point the parameter to a textbox on a
form. Another might be to save the parameter value in a function, which
could be used as the parameter query. Another way would be to create the
report without the parameter, and pass the parameter in the Where clause in
the OpenReport method (like I did above).

HTH
Dale

"Brian Carlson" wrote in message
...
I was reading a previous post on this subject, but it appears this post has
went cold. In either case, I would like to print/save a form and/or
report
to a pdf with the file name being determined by a field value. Does
anyone
know how to automate this? In the previous post, 'Brian' gave a rough way
to
do this, but I was wondering if anyone know an alternative method or could
give a clear explanation of the one 'Brian' provided. A second
semi-related
question, I would like to have a print button on a form that when clicked
prints its related report. This related report is on a parameter query
and
therefore I need to pull the value from the current report enter it as the
parameter and also ensure that the information on the form has already
been
updated in the table and thereby is available to the report...any ideas.
Thanks in advance for the help.

Brian




  #4  
Old February 12th, 2009, 02:34 AM posted to microsoft.public.access.tablesdbdesign
Brian Carlson
external usenet poster
 
Posts: 49
Default PDF name from Field (2)

Dale:
Given that I need the reports to be based upon parameter queries, or
some sort of filtering, what about if I just had a button on the actual
report that I wanted to save with a name from one of the fields? Could I use
something using Me.? Thanks for the help.

Brian


"Dale Fye" wrote:

Brian,

I may have been involved in that earlier thread (How many records in a
filtered report - 2/2/09 in the Reports newsgroup).

The method that was suggested by Albert Kallal worked like a charm. I had a
button on my form, which opened the report in PrintPreview mode, and with
the help of his recommendations, I was able to change the caption of the
report based on the value of a field in the report, and then use the
SendObject method to send that report, with the new caption as the file
name.

It looks something like:

Private sub cmd_SendReport_Click

Dim strReport as string

strReport = "rpt_ReportName"
docmd.openreport strReport, acViewPreview,, "ID = " & me.ID
Reports(strReport).Caption = "Invoice ref: " & me!InvoiceNum
Docmd.SendObject acSendReport, strReport, acFormatPDF,

Docmd.close acReport, strReport

End Sub

Your challenge may be that you want this report to be based on a parameter
query. Can you post the SQL so I can make some recommendations on how to
get around this? One way might be to point the parameter to a textbox on a
form. Another might be to save the parameter value in a function, which
could be used as the parameter query. Another way would be to create the
report without the parameter, and pass the parameter in the Where clause in
the OpenReport method (like I did above).

HTH
Dale

"Brian Carlson" wrote in message
...
I was reading a previous post on this subject, but it appears this post has
went cold. In either case, I would like to print/save a form and/or
report
to a pdf with the file name being determined by a field value. Does
anyone
know how to automate this? In the previous post, 'Brian' gave a rough way
to
do this, but I was wondering if anyone know an alternative method or could
give a clear explanation of the one 'Brian' provided. A second
semi-related
question, I would like to have a print button on a form that when clicked
prints its related report. This related report is on a parameter query
and
therefore I need to pull the value from the current report enter it as the
parameter and also ensure that the information on the form has already
been
updated in the table and thereby is available to the report...any ideas.
Thanks in advance for the help.

Brian




  #5  
Old February 14th, 2009, 03:11 PM posted to microsoft.public.access.tablesdbdesign
Brian Carlson
external usenet poster
 
Posts: 49
Default PDF name from Field (2)

See thread 'SetProperty to Field Values'

Brian

"Brian Carlson" wrote:

I was reading a previous post on this subject, but it appears this post has
went cold. In either case, I would like to print/save a form and/or report
to a pdf with the file name being determined by a field value. Does anyone
know how to automate this? In the previous post, 'Brian' gave a rough way to
do this, but I was wondering if anyone know an alternative method or could
give a clear explanation of the one 'Brian' provided. A second semi-related
question, I would like to have a print button on a form that when clicked
prints its related report. This related report is on a parameter query and
therefore I need to pull the value from the current report enter it as the
parameter and also ensure that the information on the form has already been
updated in the table and thereby is available to the report...any ideas.
Thanks in advance for the help.

Brian

 




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


All times are GMT +1. The time now is 11:34 PM.


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