Solved

Database Design Help for Historical Analysis

Posted on 2013-06-13
1
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

739 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