Solved

Database Design Help for Historical Analysis

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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

746 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

13 Experts available now in Live!

Get 1:1 Help Now