Trying to Preview current record on form in a report

L

litedread

Hi All,

I have been trying to create a button on a form that will populate a
report with only the current record's info. I have tried using this
code,

DoCmd.OpenReport "rptJacket", acViewPreview, , "[VUCaseFile] = '" &
[VUCaseFile] & "'"

VUCaseFile is an automatically generated alpha-numeric field. When i
click the button i get a dialog box asking for a parameter value for
VUCaseFile. I type in the case file (which is in the format VU08-000)
and the report opens, but there is no data.

What am I doing wrong? and is there anyway that Access can use the
current VUCaseFile on the form?

Any help would be GREATLY appriciated!!

Litedread
 
M

Marshall Barton

I have been trying to create a button on a form that will populate a
report with only the current record's info. I have tried using this
code,

DoCmd.OpenReport "rptJacket", acViewPreview, , "[VUCaseFile] = '" &
[VUCaseFile] & "'"

VUCaseFile is an automatically generated alpha-numeric field. When i
click the button i get a dialog box asking for a parameter value for
VUCaseFile. I type in the case file (which is in the format VU08-000)
and the report opens, but there is no data.

What am I doing wrong? and is there anyway that Access can use the
current VUCaseFile on the form?


The VUCaseFile **field** must be in the report's record
source table/query.

Also make sure that the form record was saved before opening
the report. If there is no other mechanism saving the
record, the use:
If Me.Dirty Then Me.Dirty = False
 
L

litedread

I have been trying to create a button on a form that will populate a
report with only the current record's info. I have tried using this
code,
DoCmd.OpenReport "rptJacket", acViewPreview, , "[VUCaseFile] = '" &
[VUCaseFile] & "'"
VUCaseFile is an automatically generated alpha-numeric field. When i
click the button i get a dialog box asking for a parameter value for
VUCaseFile. I type in the case file (which is in the format VU08-000)
and the report opens, but there is no data.
What am I doing wrong? and is there anyway that Access can use the
current VUCaseFile on the form?

The VUCaseFile **field** must be in the report's record
source table/query.

Also make sure that the form record was saved before opening
the report.  If there is no other mechanism saving the
record, the use:
        If Me.Dirty Then Me.Dirty = False

Thanks Marsh!!

Cant believe it was that simple. Just added the VUCaseFile field to
the query and it worked like a charm.
Once again, thanks!!
 

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