473,503 Members | 479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert current date on a subform with Before Insert event

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
2 7641
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8547
by: Bill | last post by:
I'm having what seems to me to be an odd problem. Perhaps there is some explanation, but don't know at this point. Basically I have a form that tracks memberships and donations. The main form...
4
65597
by: YFS DBA | last post by:
How do I use VBA to insert a *new* record into a subform? I have a master form with client information, and a sub form with billing information. I want to click on a button ("Add Data") and have...
3
4481
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode...
2
1832
by: Melissa | last post by:
I have a single (not continuous) form with an Undo button for entering finished projects. On the form is also a subform that lists all finished projects for reference. When I enter the...
1
4417
by: phaddock4 | last post by:
Being fairly inexperienced at Access 2000, i've been reading many posts here for the last several days, and testing myself to find the best approach to do the following in A2K: SET UP: I have...
1
4255
by: Stephen D Cook | last post by:
I have a search form with a query-linked subform. One of the fields in the subform are date fields. Is there a way to autopopulate the DateFilled field when the person enters the field? I need...
1
1482
by: jmarr02s | last post by:
I created a subform with 4 separate fields (textboxes) each containing an 8 digit date I want the most current date to show in each of the four fields So under properties for the subform...
5
6957
by: christianlott1 | last post by:
I admit my form is pretty complex and may need a total overhaul - I have two subforms synchronized on a form through an unbound text box. When I enter a new record in the second subform it used...
5
3440
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
0
7089
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5581
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5017
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.