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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help With Forms Please...

Status
Not open for further replies.

vince99

IS-IT--Management
Mar 1, 2001
63
US
Hello,

I have created a form on which users can enter a variety of data. The Form consists of 5 different pages. I need help on printing the form. What I want to do is have a print button on each form that will print out the current form being displayed (Maybe I can select which data I want printed or something) and another button that will print out the entire 5 pages that belong to that record and thats it...

Any help is greatly appreciated.... Thanks....
 
Basically, you're looking at 6 different reports. One for each set of fields for each page(I'm assuming tab). The it's easy to add a button to each tab that will call up the appropriate report and a button on the Form's header to call the one for all fields.
 
To print only the current record, put this code behind a button for the On Click Event.

Private Sub cmdPrint_Click()
On Error GoTo cmdPrint_Click_Err

' Error message results if user tries to print a blank record. lngFieldID is the primary key.
If IsNull(Me![lngFieldID]) Then
MsgBox "Put an Error Message Here", vbExclamation
Else

' Saves record; otherwise a syntax error will result

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

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

End If

cmdPrint_Click_Exit:
Exit Sub

cmdPrint_Click_Err:
MsgBox Err.Description
Resume cmdPrint_Click_Exit

End Sub Linda Adams (Garridon@aol.com)
"The Importance of Being Grammarian," published in The Toastmaster, March 2001
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top