How do I create this report? (Access newbie) (1 Viewer)

dudezzz

Registered User.
Local time
Today, 12:29
Joined
Feb 17, 2005
Messages
66
Hi, I have used access before but lost touch. Need some help to get me started please. Forgive me for asking such an elementary question but I am stuck for more than 2 hours googling. any help would be most appreciated.

I have two tables as below (tbl1 and tbl2). I need to create a report (rpt1) as below. I have all the controls created but don't know if I need to write a query and keep the query as the control source for the rpt1. Can anyone tell me how to implement rp1 please?

1.jpg
 

Ranman256

Well-known member
Local time
Today, 13:29
Joined
Apr 9, 2015
Messages
4,337
1. make Q1 that pulls data in a date range you need. use a form for the start , end dates. ie: forms!fMyForm!txtStartDate

2. use query wizard to make a crosstab query using Q1 to create tbl1,tbl2 data.
in this xtab qry ,add the 2 date params in the query design, click PARAMETERS ,enter forms!fMyForm!txtStartDate as DateTime and forms!fMyForm!txtEndDate as DateTime

All crosstab queries using form parameters MUST have the parameters in the design.


3. image3 may need a 'reporting' table, and run append queries to add data to it.
 

dudezzz

Registered User.
Local time
Today, 12:29
Joined
Feb 17, 2005
Messages
66
thank you so much. working on your feedback now.
 

dudezzz

Registered User.
Local time
Today, 12:29
Joined
Feb 17, 2005
Messages
66
I am getting stuck with the xtab qry and unable to get it to show the data in the way you described. I don't need a form for parameters so OK with hard coding the month variable in Q1 for now.

Are you able to help me with step 2 and 3 please? i have attached a stripped down version of the db I have.

P.S. cross tab queries have been my worst nightmares!
 

Attachments

  • test.accdb
    508 KB · Views: 68

theDBguy

I’m here to help
Staff member
Local time
Today, 10:29
Joined
Oct 29, 2018
Messages
21,474
Pardon me for jumping in... Is this something you want to put on an actual Report later on? Or, is displaying this new information in a query or exporting them to Excel would be enough? Just curious...
 

dudezzz

Registered User.
Local time
Today, 12:29
Joined
Feb 17, 2005
Messages
66
Thank you for jumping in on this.

Currently folks are doing this work manually in a word doc. I am just trying to automate that. Data entry happens directly on the tables and we need to spit out a report. does that answer your question?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:29
Joined
Oct 29, 2018
Messages
21,474
does that answer your question?
Not really. In Access, there is an object called a Report (just like there's an object called Table or Form). My question was were you planning to use a Report Object to display the data in the format/layout you described above? Otherwise, if you're saying you want the data in that layout exported to a Word table, then that is not using a Report Object, which would satisfy my curiosity.
 

plog

Banishment Pending
Local time
Today, 12:29
Joined
May 11, 2011
Messages
11,646
What you have presented us would be better achieved in Excel. Put table1 input on one tab, table2 input on another tab, then have a third tab which looks at the other 2 tabs and is your report.

If there are plans to expand the functionality of this dataset, include more data or make it easier to enter data, then Access might be the better choice. But right now, you should use Excel. You really aren't using any functionality of Access and from a data perspective, you are doing it wrong with 2 tables. If you want a proper database, all that data goes into 1 table. You can have a comparable Excel system up in running in 1 hour.
 

dudezzz

Registered User.
Local time
Today, 12:29
Joined
Feb 17, 2005
Messages
66
What you have presented us would be better achieved in Excel. Put table1 input on one tab, table2 input on another tab, then have a third tab which looks at the other 2 tabs and is your report.

If there are plans to expand the functionality of this dataset, include more data or make it easier to enter data, then Access might be the better choice. But right now, you should use Excel. You really aren't using any functionality of Access and from a data perspective, you are doing it wrong with 2 tables. If you want a proper database, all that data goes into 1 table. You can have a comparable Excel system up in running in 1 hour.
Agree Excel would be a better standalone if one person were to do this.

Reasons why I want this in Access:
1. Eventually, 6 teams with different set of data will input data
2. Right now I am entering data into the tables myself. Eventually, I will have a form to collect data
3. Also after a point in time, these 6 teams will have their own report built from this central database.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 10:29
Joined
Oct 29, 2018
Messages
21,474
Okay, thanks for confirming that. I asked the question because I want to prepare you, in case you weren't aware, that you may have to write some VBA code for that report. A report gets bound to a fixed record source; whereas, a crosstab query, which is probably what you will have to get the layout you wanted, produces a dynamic structure. So, binding a report to a crosstab query sometimes needs a little bit of special handling. There are discussions available on that topic and probably some sample dbs to show how to do it too. Cheers!
 
Last edited:

plog

Banishment Pending
Local time
Today, 12:29
Joined
May 11, 2011
Messages
11,646
If this thing is to get bigger and expand to more people I suggest you get your table structure correct before building reports or forms.

1. You shouldn't have 2 tables with the exact same structure. When you do that you are using the table name to store data that should go into a field. Instead you should put all the data into 1 table and add a field so you can differentiate each record, storing whatever the table name represents in that field (e.g. SalesMan, Territory, etc.)

2. You are doing the same thing at a field level--you are storing data that should be in a field in field names. You should not have an East and a West field, instead you should have a Region field and store East/West in there.

3. Don't put time limits on your data. Right now your tables can accomodate just 1 years worth of data, you need to make it so your tables are not limited by time. Instead of a numeric [mo] field, I would change it to a [Sales_Date] Date/Time field. Then put in the first date of the month instead of just a number (6 = June 1, 2022; 7 = July 1, 2022, etc.). This way there will be no annual data purge and you can compare your data to prior periods easily.

4. No special characters or spaces in field names. Just a nitpick, but you should only use alphanumeric characters and underscores in names--it just makes coding and querying that much easier down the road.

Implementing the above, you should have just one table with this structure:

Sales
Sales_ID, autonumber, primary key
Sales_Date, date/time, first day of month for the date of sales
Sales_Type, text, this will hold a way to differenetiate what is now the names of Table1 and Table2
Sales_Region, text, this will hold East/West and any other regions you have
Sales_Amount, number, this will hold the numeric data currently in your tables that represent the sales amount

That's it, those 5 fields can now hold all the data in your 2 tables. Additionally, being in 1 table makes that report you want super easy to create.
 
Last edited:

Users who are viewing this thread

Top Bottom