Results 1 to 8 of 8
  1. #1
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15

    problems in generating a report based on crosstab query with drop down list form

    Hi there,

    I am working on a financial report access database and try to automate the reporting procedure. I have some problems and hope you can help.
    So I have 4 tables: Data, Cost Center Structure, Cost Element Structure and Period.

    In Table Data, I have CostCenter, CostElement, Data, Month, Year, Type. They are from SAP accounting system, they can have data of 2016 actual expense and budget for every month; data in 2015. The table looks like:

    Click image for larger version. 

Name:	1.jpg 
Views:	14 
Size:	76.7 KB 
ID:	21833
    In Table Cost Center Structure, we have the name of the costcenter, the group for different cost centers, and they have different level of grouping.
    Click image for larger version. 

Name:	2.png 
Views:	14 
Size:	7.7 KB 
ID:	21834



    In Table Cost Element Structure, we have cost element grouped. Sometimes they only need to be sum up as revenue or expenses, sometimes they are in more detailed group.
    Click image for larger version. 

Name:	3.png 
Views:	15 
Size:	5.1 KB 
ID:	21835
    In Table Period, we have Apr as the 1st month of our fiscal year, and it helps to sorting.
    Click image for larger version. 

Name:	4.png 
Views:	15 
Size:	2.4 KB 
ID:	21836
    What I want, is a form with two combo boxes, so the user would choose which cost center, and which month. And generate a report of this cost center on chosen month, like:

    Click image for larger version. 

Name:	5.jpg 
Views:	14 
Size:	251.3 KB 
ID:	21837


    I used a query, say query 1, to connect financial data with element, and sum up the data. Another crosstab query on query 1 to show data for 2016 Act and 2016 Bud. I have also built a form with two combo boxes, let the user chose month and cost center.

    But when I run the query, it wont work. It says the query is bigger than 2G or do not recognize the Criteria I embedded in the query to connect with combo box.

    I want to know if my methodology is correct. Is there any more direct way to do that?

    I am new to Access, and I really appreciate your help!

    Thanks,

    Luna

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Paul, that link doesn't open a page related to crosstab, it's a MS Support search page.

    Here is another reference about crosstabs http://allenbrowne.com/ser-67.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Thank you guys.

    The thing is, my crosstab query works fine. When I add a combo box, say select cost center, it wont work.

    like what showed on June7's link, mine return a message box says: can not find "[Forms].[Form1].[StartDate]"

    Handle parameters

    A query can ask you to supply a value at runtime. It pops up a parameter dialog if you enter something like this:
    [What order date]
    Or, it can read a value from a control on a form:
    [Forms].[Form1].[StartDate]

    But, parameters do not work with crosstab queries, unless you:
    a) Declare the parameter, or
    b) Specify the column headings.

    To declare the parameter, choose Parameters on the Query menu. Access opens a dialog. Enter the name and specify the data type. For the examples above, use the Query Parameters dialog like this:
    Parameter Data Type
    [What order date] Date/Time
    [Forms].[Form1].[StartDate] Date/Time
    [ OK ] [ Cancel ]
    Declaring your parameters is always a good idea (except for an Access bug in handling parameters of type Text), but it is not essential if you specify your column headings.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Did you follow the article instructions? Did you declare parameter?

    Post your attempts for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Hi June7,

    I followed the instruction and fixed most of the problems. However, I failed to connect the parameter with combo box, it pops up message box, and if I manually input data, it works, but I failed to apply the Filter from a form.

    Any thought on that?

    Thanks,

    Luna

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I've never needed CROSSTAB queries. So no idea.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    lonely is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Aug 2015
    Posts
    15
    Hi June7,

    After working on that for several days, I find a solution. Actually it is a dumb one but it works. So I have use a query, say qry1, to get the data, and a crosstab query based on qry1, so, a combo box was built based on qry1, and it works!

    I have just learned how to give you "stars" and already add reputation to your name, I am very appreciative!

    Thanks,

    Luna

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Generating Report Based off input from a form
    By bryanCalabro in forum Reports
    Replies: 9
    Last Post: 06-12-2015, 03:03 PM
  2. Calculate Due date based on drop down list
    By Back2Basics in forum Access
    Replies: 2
    Last Post: 04-02-2015, 06:10 AM
  3. Replies: 2
    Last Post: 06-09-2012, 07:59 AM
  4. Report based on crosstab query
    By pbuecken in forum Reports
    Replies: 7
    Last Post: 01-16-2012, 09:59 PM
  5. Problems adding a drop down box to report/query
    By rachelm920 in forum Access
    Replies: 1
    Last Post: 05-14-2009, 09:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums