Question:
Microsoft Access Help Forms and sub form and report?
randike2007
2009-04-05 04:00:51 UTC
I have created a form. I now want to create a command button that opens a report but only with the record (with detail records in sub form) to populate the report. Every time I create the report, it brings in all records from tables not the details with the form .. asking to links with table i don't want that . the only records that I want to appear on
the report. is what i have on the form and sub form.
Three answers:
anonymous
2009-04-05 11:30:35 UTC
What you need to do is to is to set the recordsource of the report to the name of the table/query wherein your records are found, then on the command button put this code



DoCmd.OpenReport "Report1", acViewPreview, , "EmployeeId = 123"



where: "Report1" is the name of the report

"EmployeeId = 123" is your criteria



to explain more, for example I want to get the information of employee with EmployeId 123 from tblEmployeeRecords table. What I need to do is to put tblEmployeeRecords table as recordsource of my report Report1 then write the above codes on the command button
?
2016-12-18 21:34:32 UTC
In get admission to, there's a pattern database noted as Northwind investors (or the like). Pull it up & attempt how the types artwork. you will see there may well be various tables used via a style. you are able to have a table of purchasers appropriate to a table containing their orders, as an occasion. The "link" is the customer call or variety that seems in the two tables. you decide on a easy container with a view to link the tables mutually. in case you positioned up your tables precise, (and if I comprehend the question precise) you would be waiting to do what you describe. the style itself, is secondary to installation the tables and the links between tables. wish this facilitates!
brayden
2009-04-05 06:20:15 UTC
Works like a charm:



http://www.eggheadcafe.com/conversation.aspx?messageid=30411096&threadid=30411096


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...