T
Terry B via AccessMonster.com
I am trying to figure out a way to save a file to disk,
where the user specifies the path and the user gets to
specify the file type, as well as have the name combined
with the current date.The code below works like I want
only if I remove the "& Format(Date, "mm-dd-yy")" from the doc name.
I also tried putting the date into the DOCmd output file
parameter and I get exactly the same results.
In the DOCmd...
I dont specify a file type, so the user is prompted.
I dont specify a path so the user is prompted.
The date is tagged onto the end of the filename like I want in the
save file dialogue box, but I get an error saying I have mispelled
the report name or it dosnt exist when I click "Save".
I can see why, because the name is
"Final Contract", not "Final Contract 5-30-05"
Is there a way to get around this?
(Access 2003) Report is based on a Query of the current record and
lanuched from the current form. Code as of now:
Private Sub Save_Rpt_Click()
On Error GoTo Err_Save_Rpt_Click
Dim stDocName As String
stDocName = "Final Contract" & Format(Date, "mm-dd-yy")
If NewRecord Then
MsgBox "This record contains no data.", vbInformation, "Invalid
Action"
Exit Sub
Else
DoCmd.OutputTo acReport, stDocName, , , True
Exit_Save_Rpt_Click:
Exit Sub
Err_Save_Rpt_Click:
MsgBox Err.Description
Resume Exit_Save_Rpt_Click
End If
End Sub
Thanks Terry Best
where the user specifies the path and the user gets to
specify the file type, as well as have the name combined
with the current date.The code below works like I want
only if I remove the "& Format(Date, "mm-dd-yy")" from the doc name.
I also tried putting the date into the DOCmd output file
parameter and I get exactly the same results.
In the DOCmd...
I dont specify a file type, so the user is prompted.
I dont specify a path so the user is prompted.
The date is tagged onto the end of the filename like I want in the
save file dialogue box, but I get an error saying I have mispelled
the report name or it dosnt exist when I click "Save".
I can see why, because the name is
"Final Contract", not "Final Contract 5-30-05"
Is there a way to get around this?
(Access 2003) Report is based on a Query of the current record and
lanuched from the current form. Code as of now:
Private Sub Save_Rpt_Click()
On Error GoTo Err_Save_Rpt_Click
Dim stDocName As String
stDocName = "Final Contract" & Format(Date, "mm-dd-yy")
If NewRecord Then
MsgBox "This record contains no data.", vbInformation, "Invalid
Action"
Exit Sub
Else
DoCmd.OutputTo acReport, stDocName, , , True
Exit_Save_Rpt_Click:
Exit Sub
Err_Save_Rpt_Click:
MsgBox Err.Description
Resume Exit_Save_Rpt_Click
End If
End Sub
Thanks Terry Best