Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Database Design Help for Historical Analysis

Posted on 2013-06-13
1
Medium Priority
?
253 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 2000 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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
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…

722 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