Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONTENTS OF A FORM AUTOMATICALLY INTO A REPORT

Status
Not open for further replies.

Lee24

Programmer
Apr 11, 2001
103
GB
CAN YOU INPUT INFORMATION ON A FORM HAVE A BUTTON THAT WHEN CLICKED CREATES A REPORT AUTOMATICALLY WILL THE INFO THAT HAS JUST BEEN TYPE IN??


THANKS

IN ADVANCE

 
Put this code behind the button:

Private Sub cmdPrint_Click()
On Error GoTo cmdPrint_Click_Err

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

DoCmd.OpenReport "rptCurrentRecord", acNormal, _
"", "[lngAutonumber]=[Forms]![frmName]![lngAutonumber]"


cmdPrint_Click_Exit:
Exit Sub

cmdPrint_Click_Err:
MsgBox Err.Description
Resume cmdPrint_Click_Exit

End Sub



Linda Adams
Visit my web site for writing and Microsoft Word tips:
 
Thanks Linda

My aim is to let the user input necessary details regarding sales, allowing them to send a snapshot copy of what they have entered!

I shall try and let you know the results.

What way do I create a report by using the wizard????
 
Hi Lee!

I do always so: I design report which include necessary data, save it (name it e.g. MyReport). In cmd button's On Click procedure I write code like following:

private sub cmdMyCommandButton_OnClick()
dim rpt as report 'Declare report
dim strReportName as string
dim strMeName as string

strMeName=me.name 'Active form name
strReportName = "MyReport"
docmd.openreport strReportName,acpreview

set rpt=reports(strReportName) 'Set opened report
rpt.recordsource=me.recordsource 'Change report's recordset to this form recordset

'Here is possible to close
'current form if it's needed

docmd.close acform strMeName

end sub


Aivars |-0

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top