Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering a report from a sub form -

Status
Not open for further replies.

kwolton

IS-IT--Management
Jul 12, 2004
11
GB
Hello There,

I have created a database which has several levels of forms on it.

Here is how my database looks, these are the tables/forms that open:-

Customer (has a customerid field on it)
Computers (filters data based on customer id field)

So when i open computers i only get computers for that customer.

I have worked out how to filter the reports to only print a report for all the computers owned by a company using the following command.

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Dim stDocName As String
Dim stDocWhere As String
stDocName = "computer"
strWhere = "[computerid]=" & Me!computerid
DoCmd.OpenReport stDocName, acNormal, , strWhere

However this prints ALL the records for computers for that customer.

I would like to only print the page which i have open so logicaly i thought... just replace customerid with computerid which is the autonumber field that the computer form uses.

However this does not work, it askes me to enter a form number for the page i want to print.

If i enter the computerid number on the page it want to print it does work, however i really want to be just hit the button and let it work.

Can anyone help?

Kind Regards

kris

 
when the input box comes up, it means the wstem doesn't recognise the name of a field, in your case, computerid

try using the format:
forms![frmName]![subFrmName]![controlName]

in the query string

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top