Hello All:
I have a date field, whereby the first record will be 6/1/12. I need the next record to show 6/2/12 automatically, etc. I want the dates to auto-fill thru 12/31/12.
How do i go about this?
Thank you!
Hello All:
I have a date field, whereby the first record will be 6/1/12. I need the next record to show 6/2/12 automatically, etc. I want the dates to auto-fill thru 12/31/12.
How do i go about this?
Thank you!
In the control source (I'll assume you are using a form) try the following in the default value,
=dmax("[field_name]","[table_name]")+1
Hi R Badger,
Actually, I'm not going to be using forms for this one; there's not much other data to enter. Once I have all my dates from 6/1/12 thru 12/31/12, i'll search out all Mondays & Thursdays to put extra info on those dates.
So, basically, i'm needing this in a table (in a field called "Service Date" )...:
6/1/2012 6/2/2012 6/3/2012 6/4/2012 6/5/2012 6/6/2012 6/7/2012 6/8/2012
(all the way thru 12/31/12).
But, you solved a long-standing problem of mine! We have another Dbase with 4-digit ID's. With your solution, keyer won't need to go to prior record to see what # was there[wasn't set up as auto-number].
Thanks much,
M
Assuming existing Table name "myTable" having a field "ServiceDate",
just check out if running below gives some guidelines :
ThanksCode:
Function populateMyTable()
Dim StartDate As Date
Dim EndDate As Date
Dim dbs As Database
StartDate = #6/1/2012#
EndDate = #12/31/2012#
Set dbs = CurrentDb
NextDate = StartDate
For i = NextDate To EndDate
strsqlInsert = "insert into MyTable (ServiceDate) VALUES (#" & NextDate & "#)"
dbs.Execute (strsqlInsert)
NextDate = DateAdd("d", 1, NextDate)
Next
MsgBox ("Successful")
End Function