Printing Individual Report

  • Thread starter Thread starter Bill Frederick
  • Start date Start date
B

Bill Frederick

New to this, got a tabel with three field, first name, last name and area.
I built a form and report for this table and put a command button on the
form to print the single report with the name that is showing. The problem
I have is that when two people have the same last name (which is what I am
using in the DoCmd event) it automatically prints the first occurance of
that name and not the one shown. I have to keep this simple so that it can
be used by a novice computer person, and I don't know much about
programming. Is there a way to include two fields in the DoCmd so that both
conditions must be on the current view and it will only print the visable
report? Here is my current button DoCmd.openReport "COMM-SHU",
acViewNormal, , "[Field1]=Forms![COMM-SHU]![Field1]". This dtable has to be
imported from Oracle daily to generate the information so there is no
primary key and no ID in the table. I keep it at Field 1 Field 3 and Field
16 for the information. Please keep it simple and detailed. Thanks
 
Bill,

To directly answer your question, yes you can refer to more than one
field in the Where Condition argument of the OpenReport, e.g....
DoCmd.OpenReport "COMM-SHU", , , "[Field1]=Forms![COMM-SHU]![Field1] And
[Field3]=Forms![COMM-SHU]![Field3]"
.... or, if your command button is in the COMM-SHU form, preferably...
DoCmd.OpenReport "COMM-SHU", , , "[Field1]='" & Me.Field1 & "' And
[Field3]='" & Me.Field3 & "'"

However, just because the data as imported from the Oracle database
doesn't have a unique identifier, doesn't mean you can't have one. I
would add a new field to the table, call it ID, Autonumber data type,
and append the imported oracle data to this table. This ID field can
then be included on your form and report, and hence you can then do...
DoCmd.OpenReport "COMM-SHU", , , "[ID]=" & Me.ID
 
Back
Top