Solved

User input for dates on Access forms and reports

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

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

My experience with Windows 10 over a one year period and suggestions for smooth operation
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
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…

831 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