Nancy,
Got the file. Fixed and sent back to you.
For others reading this thread... the OpenReport Where argument
should have been looking for [Orders_OrderID] in the report query... not
[OrderID]
Query criteria...
[Orders_OrderID] = [Forms]![F_PurchaseOrder]![OrderID]
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your
life."
I tried once again to send you the database at the contact spot. It was
again returned to me. I zipped and sent it to you and it was way
smaller
then 10
In your subform, on the OrderID key field (Enabled but Locked), use
it's
DoubleClick event to run this code...
I don't understand this procedure. Can you explain it to me a little
more
basically. I will try again to email the file to you.
Thanks for your patience.
BTW, I am using Access 2007
:
Nancy,
Did you Compact and Zip the database? What was it's size? (must
be
10MB
or less)
Did you use my Contact button on my website for your email?
Did the email subject contain the word "newsgroup"
In the email body, indicate your Acccess version, and the
form/report
involved.
The reason why I ask, is that what you indicated in this latest
post
is
correct.
Please try to resend... we're missing something here... that I
could
probably find quickly... if I could see your form.
But... let's try something different.
In your subform, on the OrderID key field (Enabled but Locked),
use
it's
DoubleClick event to run this code...
Private Sub OrderID_DblClick(Cancel As Integer)
DoCmd.OpenReport "R_PurchaseOrder", acViewPreview , , "OrderID = "
&
OrderID
End Sub
This should open the report, filtered by the OrderID
Hang in there... and, if this dowsn't work... I really need to
see
that
mdb.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in your
life."
I tried to send you a copy of the database and it was returned
undeliverable.
I went back and looked at my tables and may have spotted an error.
The Order Table is my main table for purchase orders has the
following:
Order ID-Auto number and Primary key
The Order Detail Table is my details for the subform and it has the
following:
OrderDetailID- Auto number and Primary Key
OrderID-Number
The Link Master Field is: OrderID
The Link Child Field is: OrderID
The relationship is:
Orders Table: OrderID: One
OrderDetails Table: OrderID: Many
Could my problem be with the OrderID for the two tables?
:
Nancy,
Is the OpenReport code all on one line? It should be...
Emails in newsgroups wrap any text longer than 80 characters,
so
you
may
have thought the code went on two lines.
What data type is OrderID... Text or Numeric??
If Text... (I'll put spaces between the quotes for clarity...
there
should be no spaces in the real code)
DoCmd.OpenReport "R_PurchaseOrder", acViewPreview , , "OrderID = '
" &
Me.OrderID & " ' "
(Notice the Me.OrderID, instead of Me!OrderID. Not sure that's
a
problem, but try the period.)
If Numeric...
DoCmd.OpenReport "R_PurchaseOrder", acViewPreview , , "OrderID = "
&
OrderID
Try the above. If we still have problems, could you zip and
email
me
your file/s via my website below?
Or... just the tables/forms/reports we need to duplicate the
problem.
No Charge... strictly confidential.
Use the word "newsgroup" in your subject, and tell what version
you
are
using, and the name of the form and report involved.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love... and you'll never work a day in
your
life."
Thanks for your responses.
Here is what I copied & pasted, after I removed the instructions.
The
DoCmd.Open Report line showed up in red and when I hit the debug
it
highlighted the line and told me I had a compile error. What did
I
do
wrong
now? As for your last post. I want to hit the preview report
button
on
the
form, have the current report come up to view and then print. I
have
no
problem printing from the print command under the file menu. The
problem
I
have is trying to get just the current report open without all
the
others.
I
really don't need a second command button to print. Just preview
the
report
for accuracy and then print from the file/print command and have
it
"just
print the current report'.
If I were the only one that would be using it, I would just hit
the
print
command and make sure I click current window for printing and
save
myself
the
current headache. LOL! But others will be using it and I want
to
make
sure
when they hit print, they print only the current record and not
9000
others.
Thank you for being patient with me. Currently I have a macro to
open
the
report but like I said I get all the reports and when I hit the
print
they
all print out.
Thank you for being patient with me.
Private Sub Preview_Report_Click()
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "R_PurchaseOrder", acViewPreview , , "OrderID =
" &
Me!OrderID
End Sub