Using Prior Data for a Field Default Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that inputs weekly Order data. Besides the Customer Name and
Date, (there's a start date and end date on the form - a Monday and the
following Sunday), there are 30 items on the Order Form (each chosen from a
combo box) but from week to week, only a few of them change. I would like the
default for the fields in the form to be the previous week's values so only
the changed fields need to be entered. Perhaps a DLookup method? Thank you
for your help.
 
hi,
I have a form that inputs weekly Order data. Besides the Customer Name and
Date, (there's a start date and end date on the form - a Monday and the
following Sunday), there are 30 items on the Order Form (each chosen from a
combo box) but from week to week, only a few of them change. I would like the
default for the fields in the form to be the previous week's values so only
the changed fields need to be entered. Perhaps a DLookup method?
Use a "Add" button to copy the last week record.

mfG
--> stefan <--
 
Below are two functions. One for returning the monday of the week and one
for returning the sunday of the week. If you want the previous week's dates,
call them like this:

weekstartdate(dateadd("ww",-1,date))
weekenddate(dateadd("ww",-1,date))

Function WeekEndDate(BaseDate As Date) As Date
'Dave Hargis 9/04
'Returns the last date of the accounting week for the date entered)

WeekEndDate = DateAdd("ww", 1, DateAdd("d", vbSunday - DatePart("w",
BaseDate), BaseDate))
End Function

Function WeekStartDate(BaseDate As Date) As Date
'Dave Hargis 9/04
'Returns the first date of the accounting week for the date entered)

WeekStartDate = DateAdd("d", vbMonday - DatePart("w", BaseDate), BaseDate)
End Function
 

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

Back
Top