Open report from Query

M

Mike

Hi,

I am using Access 2003 and I am hoping you guys/gals out there can help me
with a little problem. I am trying my hardest to open a report, based on a
query using data from the current record via a command button. I'm sure this
is achieveable, i just don't know how.

At the moment I run the query via a command button, which will ask for 3
pieces of criteria for the report to be generated. One is the ID and the
otherTwo require dates a start date and end date. however what i would like
to be able to do is to use the command button to extract data from the
current record as all the info needed for the report is recorded on the form
and then use this as the criteria to produce the report (the report has been
prepared from the query, with a couple of calculation fields added)... my
question to anyone good enough to reply is, it possilbe to do? I have read
loads of forums for information, but none seem to be specific to what i am
looking to achieve and most still referring to entry of criteria. I'm not an
access pro, im used to using unix based systems, so this is reletively new to
me so any guidance or info, would be really helpful on my quest.
 
K

Ken Snell \(MVP\)

Generic example of a query for such a report:

SELECT *
FROM YourTable
WHERE Field1 = Forms!NameOfForm!NameOfControl1OnForm
AND Field2 = Forms!NameOfForm!NameOfControl2OnForm
AND Field3 = Forms!NameOfForm!NameOfControl3OnForm;
 
M

Mike

Thanks for getting back to me.

But where would i enter this instruction? would this be on the query? Sorry
as I explained, i am relevetively new to this, so need a bit of instruction.

Mike
 
K

Ken Snell \(MVP\)

Open your query in design view.

In the WHERE box under the desired field that is to be filtered, type
Forms!NameOfForm!NameOfControl1OnForm
except replace the generic "NameOfForm" and "NameOfControl1OnForm" names
with the real names.

Do for all three fields.
 

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