|
tech
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Auto populate month & yearHi,
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 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 > 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 > 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 >> > > 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 >> > >
Other interesting topics
Divide One Field into 3 parts
Linking form information to specific tables repeat information in report (Access 2007) Report - how to print each page to new document. Report in Legal size Table Set-up Starting Point for Access 2003 database Daily download BIRTHDAY MAIL SHOT access table connected to excel form |
|||||||||||||||||||||||