A puzzling form/report printing problem in Access 2003

J

john431

I have a form with two subforms. The form provides all the correct
information. However, when I try to print a selected record with an
OpenReport macro on a command button on the form, it will not print out what
is displayed on the screen for the form.

There are three tables: 1) Patients, 2) Prescriptions, and 3) Physicians.
Tables 1 and 2 are linked by the field: LastName and is one to many. In
table 2 are the fields, LastName, PresID (autonumber), and Physician among
others. Tables 2 and 3 are linked by the field Physician with a one to many
link from table 3 to table 2. Table 3 has the field Physician among other
attributes.

The main form, PharmForm1, is sourced to Table 1, Patients. It has the
following subforms and textboxes:

Subform1
Child: LastName
Master: LastName
Controls: PresID (autonumber) and others
This subform consists of several prescription records uniquely identified by
PresID

Subform2
Child: PresID
Master: txtbx1
Controls: Physican and others
This control provides the Physician’s name for the selected PresID record

Txtbx1
=subform1.Form!PresID

Txtbx2
=subform2.Form!Physician


I select a patient by LastName and a unique PresID number from subform1 and
see the physican’s name in subform2. This is what I want to print out. I
tried to print this selected record using a macro tied to a command button on
the form. This macro is as follows:

Run Command
Save Record
Open Report (this is a copy of the PharmForm1 form)
Report Name: PharmForm1
Where Condition:
[LastName]=[Forms]![PharmForm1]![LastName] And "[subform1].Form![PresID]="
& [Forms]![PharmForm1]![txtbx1] And
"[subform2].Form![Physician]=" & [Forms]![PharmForm1]![txtbx2]

This expression parses correctly; there are no error messages.

The problem is that the printed report is always the form with the first
record in subform1 (which may have several records), not the one I selected.

Any help on this problem would be appreciated very much.

John
 

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