Solved

Database Design Help for Historical Analysis

Posted on 2013-06-13
1
224 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

805 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