Printing forms based on selected field value

  • Thread starter Thread starter Keith Bemis
  • Start date Start date
K

Keith Bemis

Hello,
I have created a database(access 2000) with a main form
for input of patient information and 4 subforms I would
like the correct form printed based upon a selection
chosen from the main form e.g if patient type is cash then
the cash form is printed...and only for the current and
displayed record not all records...thank you ...
Keith Bemis
 
Keith:

Normally you don't want to print a form, but to print a report that displays
the data you have in the form. Now since you have two or more types of
"forms" e.g. cash and non-cash, that may have different data elements,
create two (or more) reports that reflect what you want to output based on
that situation.

Then in your form, if you have a "Print Report" button, and assuming that
you have some option group or other control that says the patient is paying
cash or using some other method of payment. Use the patient ID for the
current record on the form to filter each report to the current record. The
code behind the print button might look like this:

If Me!OptionPaymentType = 1 Then 'Cash
Docmd.OpenReport "rptCashReceipt", acViewNormal, ,"[PatientID]= " &
Me!txtPatientIDControl
Elseif Me!OptionPaymentType = 2 Then 'Insurance
Docmd.OpenReport "rptInsuranceReceipt", acViewNormal, ,"[PatientID]= " &
Me!txtPatientIDControl
End if
 

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

Back
Top