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!

Report from Form 1

Status
Not open for further replies.

Freckles

Technical User
May 1, 2000
138
US
This is cross posted on Forms:

I have a form consisting of 5 memo text boxes. At the bottom of the form, I have a print preview button formatted with the Wizard that points to a report with the 5 memo boxes concatenated. The report is based on a query that refers back to the form with the correct record selected. Now here is the rub.

When I try to preview the report just after entering the text on the form for that particular record, no data appears on the report. But, if I close the form, then open it up again, the report is perfect. ::) Deb Koplen
deb.koplen@verizon.com

A person can stand almost anything except a succession of ordinary days.
 
Make sure the record is saved before calling the report. You can use the IsDirty property to check for changes and offer the user the oportunity to save these changes before running the report:

...
If Me.Dirty Then
'here it depends on which version of Access you're using A97 is
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If
...
 
Thanks so much for your response, but I am confused. (I do have A97) Do I enter your phrase as an expression? Where? Is there anyway that I can force a save so that it is completely transparent to the user.

I am a non-SQL person, having just semi-conquered macros and not even considering things like modules and expressions, yet. In fact, all I know about writing an expression is what I can copy.

If you have the time, I would really apprecriate you allowing me to send you my small, developmental database so that you could see my "opportunity". What makes everything worse on this side is that I am writing for people for whom Excel is extent of their advancement and are even afraid of the word "Access". ::) Deb Koplen
deb.koplen@verizon.com

A person can stand almost anything except a succession of ordinary days.
 
If you created a button to open the report the code would go in the event procedure for the button.
 
Thanks for taking such good care of me. Here is what I did that, so far, seems to work.

Private Sub PLMReport_Preview_Click()
On Error GoTo Err_PLMReport_Preview_Click
If Me.Dirty Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End If

Dim stDocName As String

stDocName = "PLM Product Report"
DoCmd.OpenReport stDocName, acPreview

Exit_PLMReport_Preview_Click:
Exit Sub

Err_PLMReport_Preview_Click:
MsgBox Err.Description
Resume Exit_PLMReport_Preview_Click

End Sub ::) Deb Koplen
deb.koplen@verizon.com

A person can stand almost anything except a succession of ordinary days.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top