Save Form As Report (1 Viewer)

kybb1

Registered User.
Local time
Today, 18:39
Joined
Dec 17, 2002
Messages
29
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......
 

kybb1

Registered User.
Local time
Today, 18:39
Joined
Dec 17, 2002
Messages
29
Rich,

Well...without going into a long drawn out story...it's the easiest way, and currently the only way, I know, to create a report from a form in code. Not my preference...but what I came up with at this time.

The reasoning why I need to create a report is a worse explanation than the answer I just gave you.

But it is something I need to do....sorry.
 
R

Rich

Guest
Can't you just click on the SaveAsReport button or use a wizard?
 

Users who are viewing this thread

Top Bottom