Linking Form and Report

N

nutmeg

Good evening,

I have a Main Entry Form for the entry of installation data. I have a
Report set up to be used as an Audit tool. I would like to have the Audit
Report pop up for review when the Save & Close button is depressed. The Form
and the Report are linked by Folio No, unfortunately I have not been
successful, when you push the Save & Close the form opens but its blank. I
have checked the underlying tables and the data seems to be there. Is there
something unusual about trying to attach a Report to a Form at all.
Private Sub btnSaveRecord_Click()
On Error GoTo Err_btnSaveRecord_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.SetWarnings False

DoCmd.RunCommand acCmdSaveRecord
DoCmd.Requery

If cbxOurProjectNumber.Value = "V0402" Then
MsgBox ("After an install for this project, an QA form is
required.")
' stDocName = "ReportNameHere"
stLinkCriteria = "[Folio]=" & Me![Folio]
DoCmd.OpenReport stDocName, , , stLinkCriteria
End If

DoCmd.Close acForm, "MainEntryForm"

Any help gratefully accepted. Thank you,
 
M

moscat via AccessMonster.com

You might want to take a look at following items....

1. You have commented out the line that states the name of the Report file.
2. If the Folio No is a number, the criteria is correct. If it is a text
field, you might need to change it to
stLinkCriteria = "[Folio]=" & "'" & Me![Folio] & "'"
3. Your OpenReport command won't give you a preview. You need to add the
Preview option like
DoCmd.OpenReport stDocName, acViewPreview, , stLinkCriteria

Hope this helps.

Good evening,

I have a Main Entry Form for the entry of installation data. I have a
Report set up to be used as an Audit tool. I would like to have the Audit
Report pop up for review when the Save & Close button is depressed. The Form
and the Report are linked by Folio No, unfortunately I have not been
successful, when you push the Save & Close the form opens but its blank. I
have checked the underlying tables and the data seems to be there. Is there
something unusual about trying to attach a Report to a Form at all.
Private Sub btnSaveRecord_Click()
On Error GoTo Err_btnSaveRecord_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.SetWarnings False

DoCmd.RunCommand acCmdSaveRecord
DoCmd.Requery

If cbxOurProjectNumber.Value = "V0402" Then
MsgBox ("After an install for this project, an QA form is
required.")
' stDocName = "ReportNameHere"
stLinkCriteria = "[Folio]=" & Me![Folio]
DoCmd.OpenReport stDocName, , , stLinkCriteria
End If

DoCmd.Close acForm, "MainEntryForm"

Any help gratefully accepted. Thank you,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top