Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / May 2008

Tip: Looking for answers? Try searching our database.

Adding prompt responses as as a field value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RT_Indy - 30 May 2008 18:34 GMT
I have a table that stores very simple sales data by product by day as below

Sales Date  Product  Sales
05/01/08    Widgets    5
05/02/08    Widgets    7
05/03/08    Widgets   10
05/04/08    Widgets   10

On a weekly basis, we need to update a "weekly total" table with weekly
totals that are used for reporting.  I want to use an append query that
prompts the user for the [Beginning Sales Date] and [Ending Sales Date] to
create range of daily data they would like to group as a week (our fiscal
weeks are not always 7 days long).  Additionally, I want to add a “Week
Ending” date that summarizes weekly sales.    In the above example let's
assume that 05/01/08 through 05/03/08 is a week.  I would like the output to
be:

Product  Sales  Week Ended
Widgets   22      05/03/08  

I don’t mind using either a prompt to allow the user to specify the “Week
Ending” date, or I can use the Date equal to the [Ending Sales Date] prompt.  
Problem is that I don’t know how to do either one without having the user
update the query every time they run it.  

Any help would be appreciated.

Robert
Klatuu - 30 May 2008 19:09 GMT
Put two text boxes on your form, one for start date the other for end date.  
The fitler the query based on the values of the controls.  For example, lets
say your form name is frmWeeklyTotals and the control names are txtWeekStart
and txtWeekEnd.  In the query builder you would use the criteria row in the
Sales Date column to do the filtering:

Field: [Sales Date]

Criteria: BETWEEN Forms!frmWeeklyTotals!txtWeekStart AND
Forms!frmWeeklyTotals!txtWeekEnd
Signature

Dave Hargis, Microsoft Access MVP

> I have a table that stores very simple sales data by product by day as below
>
[quoted text clipped - 24 lines]
>
> Robert
KARL DEWEY - 30 May 2008 19:12 GMT
In design view add a field by copying the prompt like this --
 Week Ended: [Ending Sales Date]

In SQL view it would look like this ---
SELECT [Product], Sum([Sales]) AS [Sales], [Ending Sales Date] AS [Week
Ended] ...
WHERE [Sales Date] Between [Beginning Sales Date] AND [Ending Sales Date] ...
Signature

KARL DEWEY
Build a little - Test a little

> I have a table that stores very simple sales data by product by day as below
>
[quoted text clipped - 24 lines]
>
> Robert
RT_Indy - 30 May 2008 19:26 GMT
Thank you both for your responses.  Karl, the design view solution worked
great and is exactly what I needed.    
Signature

Robert

> In design view add a field by copying the prompt like this --
>   Week Ended: [Ending Sales Date]
[quoted text clipped - 32 lines]
> >
> > Robert
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.