Find Next Month from a Field

G

Guest

I need to have a field display the next month from a date entered in a field,
if one enters March 2006 in a field, then I need to have another field
display April 2006. I've tried working with the code supplied by MS - (
DateSerial(Year(Date()), Month(Date()) + 1, 1) - in various ways but am not
having any success. Thanks so much!
 
D

DW

Jani try,

=DateSerial(year([name of your field]), month([name of your field])+1)

Make sure you are using a date format in your field
 
D

Douglas J. Steele

DateSerial needs 3 arguments: a year, a month and a day. You forgot to
include the day value:

=DateSerial(Year([name of your field]), Month([name of your field])+1, 1) to
get the first day of the next month.

If the intent is to be one month from the given date, you could use

=DateSerial(Year([name of your field]), Month([name of your field])+1,
Day([name of your field])

or, probably better,

=DateAdd("m", 1, [name of your field])

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


DW said:
Jani try,

=DateSerial(year([name of your field]), month([name of your field])+1)

Make sure you are using a date format in your field



Jani said:
I need to have a field display the next month from a date entered in a
field,
if one enters March 2006 in a field, then I need to have another field
display April 2006. I've tried working with the code supplied by MS - (
DateSerial(Year(Date()), Month(Date()) + 1, 1) - in various ways but am
not
having any success. Thanks so much!
 
G

Guest

I used the suggestion of =DateAdd("m", 1, [name of your field]) and it worked
first time! Thank you so much!!!

Douglas J. Steele said:
DateSerial needs 3 arguments: a year, a month and a day. You forgot to
include the day value:

=DateSerial(Year([name of your field]), Month([name of your field])+1, 1) to
get the first day of the next month.

If the intent is to be one month from the given date, you could use

=DateSerial(Year([name of your field]), Month([name of your field])+1,
Day([name of your field])

or, probably better,

=DateAdd("m", 1, [name of your field])

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


DW said:
Jani try,

=DateSerial(year([name of your field]), month([name of your field])+1)

Make sure you are using a date format in your field



Jani said:
I need to have a field display the next month from a date entered in a
field,
if one enters March 2006 in a field, then I need to have another field
display April 2006. I've tried working with the code supplied by MS - (
DateSerial(Year(Date()), Month(Date()) + 1, 1) - in various ways but am
not
having any success. Thanks so much!
 
G

Guest

Is it possible to do record this date on a table? I have a textbox on a form
that shows the renewal date. It adds 4 years and 6 months from the assigned
date, but I would like to make a renewal field in my table in order to query
it on a report.

Douglas J. Steele said:
DateSerial needs 3 arguments: a year, a month and a day. You forgot to
include the day value:

=DateSerial(Year([name of your field]), Month([name of your field])+1, 1) to
get the first day of the next month.

If the intent is to be one month from the given date, you could use

=DateSerial(Year([name of your field]), Month([name of your field])+1,
Day([name of your field])

or, probably better,

=DateAdd("m", 1, [name of your field])

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


DW said:
Jani try,

=DateSerial(year([name of your field]), month([name of your field])+1)

Make sure you are using a date format in your field



Jani said:
I need to have a field display the next month from a date entered in a
field,
if one enters March 2006 in a field, then I need to have another field
display April 2006. I've tried working with the code supplied by MS - (
DateSerial(Year(Date()), Month(Date()) + 1, 1) - in various ways but am
not
having any success. Thanks so much!
 
D

Douglas J. Steele

Why? You should never store calculated values (unless there's a good
reason).

Create a query, and add a computed field to that query that provides the
renewal date (use the DateAdd function to add 54 months). Use the query
wherever you would otherwise have used the table.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


jeq214 said:
Is it possible to do record this date on a table? I have a textbox on a
form
that shows the renewal date. It adds 4 years and 6 months from the
assigned
date, but I would like to make a renewal field in my table in order to
query
it on a report.

Douglas J. Steele said:
DateSerial needs 3 arguments: a year, a month and a day. You forgot to
include the day value:

=DateSerial(Year([name of your field]), Month([name of your field])+1, 1)
to
get the first day of the next month.

If the intent is to be one month from the given date, you could use

=DateSerial(Year([name of your field]), Month([name of your field])+1,
Day([name of your field])

or, probably better,

=DateAdd("m", 1, [name of your field])

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


DW said:
Jani try,

=DateSerial(year([name of your field]), month([name of your field])+1)

Make sure you are using a date format in your field



I need to have a field display the next month from a date entered in a
field,
if one enters March 2006 in a field, then I need to have another field
display April 2006. I've tried working with the code supplied by MS -
(
DateSerial(Year(Date()), Month(Date()) + 1, 1) - in various ways but
am
not
having any success. Thanks so much!
 
G

Guest

Thanks for the tip. It worked great!

Douglas J. Steele said:
Why? You should never store calculated values (unless there's a good
reason).

Create a query, and add a computed field to that query that provides the
renewal date (use the DateAdd function to add 54 months). Use the query
wherever you would otherwise have used the table.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


jeq214 said:
Is it possible to do record this date on a table? I have a textbox on a
form
that shows the renewal date. It adds 4 years and 6 months from the
assigned
date, but I would like to make a renewal field in my table in order to
query
it on a report.

Douglas J. Steele said:
DateSerial needs 3 arguments: a year, a month and a day. You forgot to
include the day value:

=DateSerial(Year([name of your field]), Month([name of your field])+1, 1)
to
get the first day of the next month.

If the intent is to be one month from the given date, you could use

=DateSerial(Year([name of your field]), Month([name of your field])+1,
Day([name of your field])

or, probably better,

=DateAdd("m", 1, [name of your field])

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Jani try,

=DateSerial(year([name of your field]), month([name of your field])+1)

Make sure you are using a date format in your field



I need to have a field display the next month from a date entered in a
field,
if one enters March 2006 in a field, then I need to have another field
display April 2006. I've tried working with the code supplied by MS -
(
DateSerial(Year(Date()), Month(Date()) + 1, 1) - in various ways but
am
not
having any success. Thanks so much!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top