By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,397 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,397 IT Pros & Developers. It's quick & easy.

insert current date on a subform with Before Insert event

P: n/a
Access 2000
I have a fldCreateDate on frmCustomer(mainform)and also a
fldCreateDate on frmCustomerVisit(subform). They are one to many
relationship.
On the main form, frmCustomer, I have a Before Insert event call a
MacroCustomerCreateDate
Action: setvalue
Item: [Forms]![frmCustomer]![CreateDate]
Expression: Date( )
This is working fine; I got the current date as soon as I input
something on a new record.
On the frmCustomerVisit, I do the same, I have a Before Insert event
call a MacroCustomerVisitCreateDate
Action: setvalue
Item: [Forms]![frmCustomerVisit]![CreateDate]
Expression: Date( )
This one is not working, I don't get the current date when I start
input on a new record.
Please help!
Thank you
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 19 May 2004 04:34:39 -0700, lp*****@neh.gov (lphuong) wrote:
Access 2000
I have a fldCreateDate on frmCustomer(mainform)and also a
fldCreateDate on frmCustomerVisit(subform). They are one to many
relationship.
On the main form, frmCustomer, I have a Before Insert event call a
MacroCustomerCreateDate
Action: setvalue
Item: [Forms]![frmCustomer]![CreateDate]
Expression: Date( )
This is working fine; I got the current date as soon as I input
something on a new record.
On the frmCustomerVisit, I do the same, I have a Before Insert event
call a MacroCustomerVisitCreateDate
Action: setvalue
Item: [Forms]![frmCustomerVisit]![CreateDate]
Expression: Date( )
This one is not working, I don't get the current date when I start
input on a new record.
Please help!
Thank you


If I'm not mistaken, BeforeInsert executes just before a new record is
about to be saved, not when a new record buffer is open (that may
eventually be saved).

If you want your subform's date field to default to date() while
you're in edit mode, put logic into the subform's Form_Current event:
if me.NewRecord=true then
me.fldCreateDate = date()
end if

Chuck
Nov 12 '05 #2

P: n/a
"Chuck Van Den Corput" <NO*****************@sympatico.ca> wrote in message
news:82********************************@4ax.com...
On 19 May 2004 04:34:39 -0700, lp*****@neh.gov (lphuong) wrote:
On the frmCustomerVisit, I do the same, I have a Before Insert event
call a MacroCustomerVisitCreateDate
Action: setvalue
Item: [Forms]![frmCustomerVisit]![CreateDate]
Expression: Date( )
This one is not working, I don't get the current date when I start
If I'm not mistaken, BeforeInsert executes just before a new record is
about to be saved, not when a new record buffer is open (that may
eventually be saved).


Actually BeforeInsert will fire as soon as you "dirty" the record, but there are
circumstances where BeforeInsert *never* fires (a bug IMO). BeforeUpdate with a
test for NewRecord is what I would use.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.