Afternoon All,
What I'm trying to accomplish is SAVE the FORM as a REPORT.
I know the form must be closed in order to do so, so I'm using a combo box from another form to pick from a list of available forms. In the AfterUpdate Event the following code runs:
(In order to make it work I had to have 2 txtboxes on the form, txtFormName and txtRenameForm.)
Me.txtFormName = Me.cboForms.Column(0)
Me.txtRenameForm = Me.cboForms.Column(0)
strOldFrmName = Me.cboForms.Column(0)
strOldFrmName = Me.txtFormName
strReportName = "rpt" & Mid(strOldFrmName, 4)
strNewFormName = Me.txtRenameForm
strFormName = "frm" & Mid(strNewFormName, 4)
DoCmd.Rename strReportName, acForm, strOldFrmName
DoCmd.SelectObject acForm, strReportName, True
SendKeys "ú{home}+^{right 2}-{end}", True
DoCmd.Rename strNewFormName, acForm, strReportName
Mucked up as it is...I pick the form from a combo box...rename the form to a "report name" then using the SEND KEYS, SAVE AS, and finally rename the form back to it's original name.
If there is a better way AND I'M SURE THERE IS....I'd love to see it.
Thanks for any input......
What I'm trying to accomplish is SAVE the FORM as a REPORT.
I know the form must be closed in order to do so, so I'm using a combo box from another form to pick from a list of available forms. In the AfterUpdate Event the following code runs:
(In order to make it work I had to have 2 txtboxes on the form, txtFormName and txtRenameForm.)
Me.txtFormName = Me.cboForms.Column(0)
Me.txtRenameForm = Me.cboForms.Column(0)
strOldFrmName = Me.cboForms.Column(0)
strOldFrmName = Me.txtFormName
strReportName = "rpt" & Mid(strOldFrmName, 4)
strNewFormName = Me.txtRenameForm
strFormName = "frm" & Mid(strNewFormName, 4)
DoCmd.Rename strReportName, acForm, strOldFrmName
DoCmd.SelectObject acForm, strReportName, True
SendKeys "ú{home}+^{right 2}-{end}", True
DoCmd.Rename strNewFormName, acForm, strReportName
Mucked up as it is...I pick the form from a combo box...rename the form to a "report name" then using the SEND KEYS, SAVE AS, and finally rename the form back to it's original name.
If there is a better way AND I'M SURE THERE IS....I'd love to see it.
Thanks for any input......