A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Computing a Date in a Form



 
 
Thread Tools Display Modes
  #1  
Old August 29th, 2004, 07:19 PM
external usenet poster
 
Posts: n/a
Default Computing a Date in a Form

In a form I want the user to enter a follow up time,
i.e., 1 week, 1 month, 3 months, etc. Based on that
response I want to store an actual date based on today's
date plus whatever was chosen as the follow up timeframe,
1 week would be today + 7. How do I do that?
  #2  
Old August 29th, 2004, 07:53 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Assuming you can figure out how to convert what the user enters into days,
use the DateAdd function to add that many days to today's date and then
you'll have the desired date.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
In a form I want the user to enter a follow up time,
i.e., 1 week, 1 month, 3 months, etc. Based on that
response I want to store an actual date based on today's
date plus whatever was chosen as the follow up timeframe,
1 week would be today + 7. How do I do that?



  #3  
Old August 29th, 2004, 08:29 PM
external usenet poster
 
Posts: n/a
Default

I realize that's what I need to use but I can't get my
formula to work. The user will be selecting from a drop
down with options of 1 week, 1 month, 3 months, 1 year,
for example. So, I tried an IIf with DateAdd using Date
() as today's date. Would you mind sending me a sample
of the statement? THANKS so much.

-----Original Message-----
Assuming you can figure out how to convert what the user

enters into days,
use the DateAdd function to add that many days to

today's date and then
you'll have the desired date.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
In a form I want the user to enter a follow up time,
i.e., 1 week, 1 month, 3 months, etc. Based on that
response I want to store an actual date based on

today's
date plus whatever was chosen as the follow up

timeframe,
1 week would be today + 7. How do I do that?



.

  #4  
Old August 29th, 2004, 09:14 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

How does your combo box get those values?

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I realize that's what I need to use but I can't get my
formula to work. The user will be selecting from a drop
down with options of 1 week, 1 month, 3 months, 1 year,
for example. So, I tried an IIf with DateAdd using Date
() as today's date. Would you mind sending me a sample
of the statement? THANKS so much.

-----Original Message-----
Assuming you can figure out how to convert what the user

enters into days,
use the DateAdd function to add that many days to

today's date and then
you'll have the desired date.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
In a form I want the user to enter a follow up time,
i.e., 1 week, 1 month, 3 months, etc. Based on that
response I want to store an actual date based on

today's
date plus whatever was chosen as the follow up

timeframe,
1 week would be today + 7. How do I do that?



.



  #6  
Old August 31st, 2004, 02:50 AM
external usenet poster
 
Posts: n/a
Default

From a table.

-----Original Message-----
How does your combo box get those values?

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I realize that's what I need to use but I can't get my
formula to work. The user will be selecting from a

drop
down with options of 1 week, 1 month, 3 months, 1 year,
for example. So, I tried an IIf with DateAdd using

Date
() as today's date. Would you mind sending me a sample
of the statement? THANKS so much.

-----Original Message-----
Assuming you can figure out how to convert what the

user
enters into days,
use the DateAdd function to add that many days to

today's date and then
you'll have the desired date.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
In a form I want the user to enter a follow up time,
i.e., 1 week, 1 month, 3 months, etc. Based on that
response I want to store an actual date based on

today's
date plus whatever was chosen as the follow up

timeframe,
1 week would be today + 7. How do I do that?


.



.

  #7  
Old August 31st, 2004, 07:20 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

One way would be to add a field to your table (name it fldDays) that is
holding the data that your combo box uses. Put appropriate values in that
field for each record so that the number is the number of days to be added
when that item is selected. For example, 7 is the value for 1 week, 21 is
the value for 3 weeks, etc.

Then use a multicolumn combo box that uses this as a query (example) for the
row source:
SELECT fldDays, TimeTermField FROM TableName;

For the combo box's properties:
- set the bound column to 1.
- set the column count to 2.
- set the column widths to 0";1'.

This way, when the user selects the term desired (which will show in the
dropdown list), the combo box's value will be the actual number of days to
be used. Thus, you could use the DateAdd function to get the new date from
today's date:
NewDate = DateAdd("d", Me.ComboBoxName.Value, Date())

This won't be an exact method for "one month".

Another option could be to put two fields in the table, where one field is
the abbreviation in DateAdd for the specific term interval (m for month, d
for day, yyyy for year; the other field would be the number. Then you could
have three columns in the combo box query, and use this query as the Row
Source:
SELECT fldDays, fldInterval, TimeTermField FROM TableName;

For the combo box's properties:
- set the bound column to 1.
- set the column count to 3.
- set the column widths to 0";0";1'.

Then, you could use the DateAdd function to get the new date from today's
date:
NewDate = DateAdd(Me.ComboBoxName.Column(1), Me.ComboBoxName.Value,
Date())

--

Ken Snell
MS ACCESS MVP

wrote in message
...
From a table.

-----Original Message-----
How does your combo box get those values?

--

Ken Snell
MS ACCESS MVP

wrote in message
...
I realize that's what I need to use but I can't get my
formula to work. The user will be selecting from a

drop
down with options of 1 week, 1 month, 3 months, 1 year,
for example. So, I tried an IIf with DateAdd using

Date
() as today's date. Would you mind sending me a sample
of the statement? THANKS so much.

-----Original Message-----
Assuming you can figure out how to convert what the

user
enters into days,
use the DateAdd function to add that many days to
today's date and then
you'll have the desired date.

--

Ken Snell
MS ACCESS MVP

wrote in message
...
In a form I want the user to enter a follow up time,
i.e., 1 week, 1 month, 3 months, etc. Based on that
response I want to store an actual date based on
today's
date plus whatever was chosen as the follow up
timeframe,
1 week would be today + 7. How do I do that?


.



.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
automate access form patient name, date field, time to outlook app serverrunner Using Forms 0 July 27th, 2004 03:59 AM
Query Criteria where a single date comes from a form Gary O Running & Setting Up Queries 3 July 23rd, 2004 05:24 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM
Problem with Date Restrictor on Form Chuck W Running & Setting Up Queries 3 June 10th, 2004 10:47 PM
Does date fall between two ranges? MR Worksheet Functions 4 January 14th, 2004 05:08 PM


All times are GMT +1. The time now is 06:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.