Printing a report

hmongie

New Member
Joined
Mar 26, 2003
Messages
16
How can I make a command button on my switch board that will print a report with only the current data from a table and not all the data that exist on my table?


Thanks a million, you guys are great!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
What do you mean by current data? Is it defined by the current date? If so you could put the table in a query and put: =now() in the criteria for date and use the query as the control source for the report.


If not give some more details.


Ziggy
 
Upvote 0
Hey there Ziggy,

Okay this is what I have:

I have a table that takes data entries from a form. Then I have a report that takes the the datas from the table and displays them in an orderly fashion. Now when I print the report, it prints all of the entries. I only want to print a the current entries. Like, if I was doing some work today, I only what to print those entries.

The main function of the database is to keep a daily activity report of what is happening. If you can help, I will appreciate it very much! Thanks a million!
 
Upvote 0
I had a reply all typed out and when I submitted it, it didn't accept and I lost everything !@#$%.

I'll have to get back to you tomorrow.

But quickly I was going to recommend using a combobox to select the dates from a table and use it to filter the report to only print that day. This way if you miss a day you can always call it up and reprint it.

I'll get back to you with specifics if you don't know what I mean.

Ziggy
 
Upvote 0
Hey there Ziggy, if you can give me specifics about creating a query to print our the report it would be most appreciative. I'm very new to database designs. Although, my true skills are in web developement. Thanks.
 
Upvote 0
I hope this isn't too complicated to start you off, I'll explain step by step.

You can use your report as it is, what I'm go explain is how to use a Combo box on a form to select a date record and only print records for that date. You asked for Current date, but unless the data alters after the current date this should be of use to you.

Step one:

Go to the Query Tab and select "New" in design view. Add the Table that is used in your report. From the field list add only the date field. Sort it in descending order and ensure "Totals" is activated (on view menu) leave as "group by". Save as DateLookup (for example).

I suggested this in case your table has duplicates of the same date, since this query will be used for the lookup, plus you can sort the query in descending to bring up the latest date first.


Step Two:

Start a new form in design view (cancel wizard). Drop a combo box onto the grid. With wizard select first option to Lookup values in Table/Query, then select the query Above, then the Date field, choose the option to "Remember for later use" Save the Form and name the control.

Step Three:

Double click the Control to go to properties. Find the "on change" Event in the list and click the button (3 dots). Choose Macro and Save it.

Choose the "Open Report" Action in the Macro, In the arguments below select your report, then "Print Preview" (for testing). Now the next part is key to making this work.

IN the "WHERE" section put the following:

[ReportsDatefield]=[Forms]![Form Namefrom Combo]![Name of Combo]

Save the Macro and the Form.

Now go to "Form View" and select a date, after it is selected the report should open and only display the selected recods.


On your Switch board set a button to open the form, now when you select the combo the most current date will be at the top.



Ziggy
 
Upvote 0
I explained the previous methed because it gives your more flexibility. to get back to your question about current date do this:

Start a new query, and bring the table that your report is based on and put all the fields into the grid.

In the Date field in the "Criteria cell" put: Now()

Ensure the "Totals" option is turned off. Run the query and it should only display the current dates records.

Now go to your report in design view and change the control source to point to this query. The results should only contain the current dates.

I recommend you make a copy of your database to test these things out.

Good luck


Ziggy
 
Upvote 0

Forum statistics

Threads
1,221,527
Messages
6,160,342
Members
451,638
Latest member
MyFlower

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top