I must be thick???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everyone,

Worked myself into a state, trying to print a single entry from a form.

I have a form with subform. SHIPMENT_ID is the key value here.
The user can tab thru the various shipments and see Shipment data and the
details on the subform.

I designed the form to be printable and the printouts look ok, but no matter
what I try I get ALL SHIPMENT_ID's.

I've tried to Run a macro that calls the form in print preview mode:
Me.SHIPMENT_ID.Setfocus
DoCmd.RunMacro macroname
and the macro has a Condition of:
[SHIPMENT_ID]=Form![POD_Form]![SHIPMENT_ID]

I've also tried to run a report:
DoCmd.OpenReport Reportname, acViewPreview, , SHIPMENT_ID = Me.SHIPMENT_ID

I still get all records, not the one's where the Shipment id's match the one
on the form.

As Always, thanks in advance for your kind help

Pat
 
Assuming SHIPMENT_ID is a numeric field, try

DoCmd.OpenReport Reportname, acViewPreview, , _
"SHIPMENT_ID = " & Me.SHIPMENT_ID

If it's a text field, you need quotes around the value:

DoCmd.OpenReport Reportname, acViewPreview, , _
"SHIPMENT_ID = '" & Me.SHIPMENT_ID & "'"

Exagerated for clarity, that's

DoCmd.OpenReport Reportname, acViewPreview, , _
"SHIPMENT_ID = ' " & Me.SHIPMENT_ID & " ' "
 
Pat Backowski said:
Hi Everyone,

Worked myself into a state, trying to print a single entry from a form.

I have a form with subform. SHIPMENT_ID is the key value here.
The user can tab thru the various shipments and see Shipment data and the
details on the subform.

I designed the form to be printable and the printouts look ok, but no
matter
what I try I get ALL SHIPMENT_ID's.

I've tried to Run a macro that calls the form in print preview mode:
Me.SHIPMENT_ID.Setfocus
DoCmd.RunMacro macroname
and the macro has a Condition of:
[SHIPMENT_ID]=Form![POD_Form]![SHIPMENT_ID]

I've also tried to run a report:
DoCmd.OpenReport Reportname, acViewPreview, , SHIPMENT_ID =
Me.SHIPMENT_ID

I still get all records, not the one's where the Shipment id's match the
one
on the form.

As Always, thanks in advance for your kind help

Pat

Try this for your OpenReport call:

DoCmd.OpenReport Reportname, acViewPreview, , "SHIPMENT_ID = " &
Me.SHIPMENT_ID


Carl Rapson
 

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