jeran042
Registered User.
- Local time
- Today, 05:23
- Joined
- Jun 26, 2017
- Messages
- 127
I have a report with a series of command buttons. One of which outputs the report to a PDF. This works fine.
What I am trying to accomplish is to move the position of the reports title textbox from one position to another, and then back again.
Here is what I have for code:
The report successfully outputs, and the textbox position on the PDF is correct, but the textbox does not reset when you are seeing it on screen.
I have done a bit of research, and, in my mind at least, this is how you would accomplish this.
What am I doing wrong?
Much appreciated,
What I am trying to accomplish is to move the position of the reports title textbox from one position to another, and then back again.
Here is what I have for code:
Code:
Private Sub btnPDF_Click()
'Error handling
On Error GoTo Error_Handler
Dim strFormName As String
Dim MyPath As String
strFormName = "Month to Date" & Format(Date, "_mmddyy") & ".pdf"
MyPath = "Y:\Budget process information\EXPORTS\"
'Set position of the Report tile
Me.txtREPORT_TITLE.Left = 0.0417 'this works perfect, basically aligning it to the left margin
DoCmd.OutputTo acOutputReport, "RPT: TEMP_MONTH_TO_DATE_DAILY", acFormatPDF, MyPath + strFormName, True
MsgBox " Your Report Has Successfully Run " & _
vbCrLf & " You can find it at: " & MyPath, vbInformation, "SUCCESS"
'Close report
'DoCmd.Close acReport, Report.Name
'Reset report title position
Me.txtREPORT_TITLE.Left = 1.0104 'this does nothing. Should place it to the right of a image on the report
Error_Handler_Exit:
Exit Sub
Error_Handler:
Select Case Err.NUMBER
Case 2501
Err.Clear
Resume Error_Handler_Exit
Case Else
MsgBox "Error No. " & Err.NUMBER & vbCrLf & "Description: " & Err.Description, vbExclamation, "Database Error"
Err.Clear
Resume Error_Handler_Exit
End Select
End Sub
The report successfully outputs, and the textbox position on the PDF is correct, but the textbox does not reset when you are seeing it on screen.
I have done a bit of research, and, in my mind at least, this is how you would accomplish this.
What am I doing wrong?
Much appreciated,