Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

User input for dates on Access forms and reports

Posted on 2013-06-07
3
Medium Priority
?
366 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:Skip Sleeper
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 2000 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:Skip Sleeper
ID: 39230195
Thank you Scott, just what I was looking for!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

782 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