Home All Groups Group Topic Archive Search About

Auto populate month & year

Author
4 Jul 2009 4:54 AM
Garu
Hi,

I have a table with 'mnth' and 'yr' columns and what I would like them to
auto populate secquentially based on the value of  'mnth' and 'yr' entered
as first record.

To illustrate, assumming on the first record the user enters mnth="November"
and yr="2008" then the next record to be created will auto populate to
"December" and "2008", then next record will be "January" and "2008" and so
on and so forth...

Hope you got my point.

Garu

Author
4 Jul 2009 7:20 AM
Garu
Sorry, the third record should be mnth="January" and yr="2009"

Show quoteHide quote
"Garu" <o**@brunet.bn> wrote in message
news:OUuI3NG$JHA.4692@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I have a table with 'mnth' and 'yr' columns and what I would like them to
> auto populate secquentially based on the value of  'mnth' and 'yr' entered
> as first record.
>
> To illustrate, assumming on the first record the user enters
> mnth="November" and yr="2008" then the next record to be created will auto
> populate to "December" and "2008", then next record will be "January" and
> "2008" and so on and so forth...
>
> Hope you got my point.
>
> Garu
>
Are all your drivers up to date? click for free checkup

Author
4 Jul 2009 3:56 PM
TedMi
Much better to have a single field of type DATE, say MyDate. In reports, you
can display MonthName(Month(MyDate)) and Year(MyDate), which will give you
what you want.
Assuming that each new record is to be dated one month after the last-dated
record:
Enter all the fields of the new record EXCEPT the MyDate field, then run
this query:
UPDATE MyTable SET MyDate = DateAdd("m", 1, DMax("MyDate", "MyTable")) WHERE
MyDate IS NULL

-TedMi

Show quoteHide quote
"Garu" <o**@brunet.bn> wrote in message
news:OUuI3NG$JHA.4692@TK2MSFTNGP02.phx.gbl...
> Hi,
>
> I have a table with 'mnth' and 'yr' columns and what I would like them to
> auto populate secquentially based on the value of  'mnth' and 'yr' entered
> as first record.
>
> To illustrate, assumming on the first record the user enters
> mnth="November" and yr="2008" then the next record to be created will auto
> populate to "December" and "2008", then next record will be "January" and
> "2008" and so on and so forth...
>
> Hope you got my point.
>
> Garu
>
Author
4 Jul 2009 7:13 PM
John Spencer
Unfortunately that query will probably give you the same date for every
record where the date is null.


'====================================================
  John Spencer
  Access MVP 2002-2005, 2007-2009
  The Hilltop Institute
  University of Maryland Baltimore County
'====================================================


TedMi wrote:
Show quoteHide quote
> Much better to have a single field of type DATE, say MyDate. In reports, you
> can display MonthName(Month(MyDate)) and Year(MyDate), which will give you
> what you want.
> Assuming that each new record is to be dated one month after the last-dated
> record:
> Enter all the fields of the new record EXCEPT the MyDate field, then run
> this query:
> UPDATE MyTable SET MyDate = DateAdd("m", 1, DMax("MyDate", "MyTable")) WHERE
> MyDate IS NULL
>
> -TedMi
>
> "Garu" <o**@brunet.bn> wrote in message
> news:OUuI3NG$JHA.4692@TK2MSFTNGP02.phx.gbl...
>> Hi,
>>
>> I have a table with 'mnth' and 'yr' columns and what I would like them to
>> auto populate secquentially based on the value of  'mnth' and 'yr' entered
>> as first record.
>>
>> To illustrate, assumming on the first record the user enters
>> mnth="November" and yr="2008" then the next record to be created will auto
>> populate to "December" and "2008", then next record will be "January" and
>> "2008" and so on and so forth...
>>
>> Hope you got my point.
>>
>> Garu
>>
>
>
Author
6 Jul 2009 5:14 AM
Garu
Thanks, that pretty much gave me the idea.

Show quoteHide quote
"TedMi" <te***@hotmail.com> wrote in message
news:OLYa4$L$JHA.3732@TK2MSFTNGP02.phx.gbl...
> Much better to have a single field of type DATE, say MyDate. In reports,
> you can display MonthName(Month(MyDate)) and Year(MyDate), which will give
> you what you want.
> Assuming that each new record is to be dated one month after the
> last-dated record:
> Enter all the fields of the new record EXCEPT the MyDate field, then run
> this query:
> UPDATE MyTable SET MyDate = DateAdd("m", 1, DMax("MyDate", "MyTable"))
> WHERE MyDate IS NULL
>
> -TedMi
>
> "Garu" <o**@brunet.bn> wrote in message
> news:OUuI3NG$JHA.4692@TK2MSFTNGP02.phx.gbl...
>> Hi,
>>
>> I have a table with 'mnth' and 'yr' columns and what I would like them to
>> auto populate secquentially based on the value of  'mnth' and 'yr'
>> entered as first record.
>>
>> To illustrate, assumming on the first record the user enters
>> mnth="November" and yr="2008" then the next record to be created will
>> auto populate to "December" and "2008", then next record will be
>> "January" and "2008" and so on and so forth...
>>
>> Hope you got my point.
>>
>> Garu
>>
>
>

Bookmark and Share