Solved

User input for dates on Access forms and reports

Posted on 2013-06-07
3
356 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
My experience with Windows 10 over a one year period and suggestions for smooth operation
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

947 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

23 Experts available now in Live!

Get 1:1 Help Now