Solved

User input for dates on Access forms and reports

Posted on 2013-06-07
3
353 Views
Last Modified: 2013-06-07
Hi Experts,

I am creating a 2010 Access db that will have forms/reports for printing labels that have the same date on each label and reports that will require  a different date at the head of every column.  What is the best method for getting the date(s) from users?  And how would I calculate the series of dates (for seven consecutive days) on the columns in the reports?

Thank you!
0
Comment
Question by:fargus47
3 Comments
 
LVL 19

Expert Comment

by:Eric Sherman
ID: 39230130
Create a little user prompt form with unbound fields for any user input information that opens first.  When completed, use a Continue button on the form to minimize it or make it invisible and run your report.  You can pass the values from your minimized from to your report.  Use the close event of your report to close the minimized form.

ET
0
 
LVL 20

Accepted Solution

by:
clarkscott earned 500 total points
ID: 39230159
I think you will need 2 input dates; one for the constant data (same date on every label) and a "begin" date (with 6 more calculated consecutive dates).

I would create a form with 2 text boxes labelled as "fixed date" and "begin date" (or whatever works for you).

Create 2 public variables:
public glbConstantDate as date
Public glbBeginDate as date

Create 2 functions to retrieve these values:

function get_glbConstantDate() as date
get_glbConstantDate = glbConstantdate
end function

function get_glbBeginDate() as date
get_glbBeginDate = glbBeginDate
end function

Now, on the afterupdate event of the "Fixed Date" textbox:

glbConstantDate = 0
if not isnull(me.YourFixedDateBoxName) then glbConstantDate = me.YourFixedDateBoxName

In the afterupdate of the "Begin Date" textbox:

glbBeginDate = 0
If not isnull(me.YourBeginDateBoxName) then glbBeginDate = me.YourBeginDateBoxName

Anywhere you want to use the Constant date - simply use this as it's source:
=get_glbConstantDate()

In the columns:
=get_glbBeginDate()
=dateadd("d",1,get_glbBeginDate())
=dateadd("d",2,get_glbBeginDate())
 
and so on.

Scott C
0
 

Author Closing Comment

by:fargus47
ID: 39230195
Thank you Scott, just what I was looking for!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
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.
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…

757 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

19 Experts available now in Live!

Get 1:1 Help Now