Solved

Database Design Help for Historical Analysis

Posted on 2013-06-13
1
215 Views
Last Modified: 2013-07-23
I'm trying to create a form in my database that will show historical information on part number purchasing. I have a query that is linked to my SQL tables in my ERP system. The query shows rows for each receipt of material. What I'm looking to do is create a form that a user can select a part number from a combo box and also a starting month from another combo box and that have it show the receipt quantity per month from the starting month that was selected to the current month. The max # of months I want to show is 24 months. So how would I create the controls on the form or structure them to be able to show 24 months after a starting month is selected? I need some help/ideas on how to construct this form. Any ideas would be greatly appreciated. I'm trying to make it as simple as possible and without having any performance issues trying to gather all this data onto 1 form. Just need some input/ideas or even samples.
0
Comment
Question by:Lawrence Salvucci
1 Comment
 
LVL 12

Accepted Solution

by:
pdebaets earned 500 total points
ID: 39245789
You can do this with a form with criteria fields and a list box that displays your results, or a subform that displays the results. I would recommend the latter.

You can use the DateAdd function to find a date 24 months after a given starting date. Ex.:

dim dteStartingDate as Date
dteStartingDate = #1/1/2000#
debug.print dateadd("m",24,dteStartingDate)

You can build an SQL statement for your subform from the criteria entered. Ex.:

dim strSQL as string
strSQL = ""
strSQL = strSQL & "Select "
strSQL = strSQL & "    * "
strSQL = strSQL & "  From "
strSQL = strSQL & "       MyTable "
strSQL = strSQL & "  Where "
strSQL = strSQL & "      MyTableField =  " & Forms!MyFormName!MyCriteriaControl
strSQL = strSQL & "     AND "
strSQL = strSQL & "      MyOtherTableField =  " & Forms!MyFormName!MyOtherCriteriaControl
strSQL = strSQL & ";"

You can set the recordsource of your subform like so

Forms!MyFormName!MySubformControlName.Form.recordsource = strSQL
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now