473,657 Members | 2,397 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(mai nform)and also a
fldCreateDate on frmCustomerVisi t(subform). They are one to many
relationship.
On the main form, frmCustomer, I have a Before Insert event call a
MacroCustomerCr eateDate
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 frmCustomerVisi t, I do the same, I have a Before Insert event
call a MacroCustomerVi sitCreateDate
Action: setvalue
Item: [Forms]![frmCustomerVisi t]![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 7647
On 19 May 2004 04:34:39 -0700, lp*****@neh.gov (lphuong) wrote:
Access 2000
I have a fldCreateDate on frmCustomer(mai nform)and also a
fldCreateDat e on frmCustomerVisi t(subform). They are one to many
relationship .
On the main form, frmCustomer, I have a Before Insert event call a
MacroCustomerC reateDate
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 frmCustomerVisi t, I do the same, I have a Before Insert event
call a MacroCustomerVi sitCreateDate
Action: setvalue
Item: [Forms]![frmCustomerVisi t]![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=tr ue then
me.fldCreateDat e = date()
end if

Chuck
Nov 12 '05 #2
"Chuck Van Den Corput" <NO************ *****@sympatico .ca> wrote in message
news:82******** *************** *********@4ax.c om...
On 19 May 2004 04:34:39 -0700, lp*****@neh.gov (lphuong) wrote:
On the frmCustomerVisi t, I do the same, I have a Before Insert event
call a MacroCustomerVi sitCreateDate
Action: setvalue
Item: [Forms]![frmCustomerVisi t]![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
8561
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 tracks the individual and the subform allows me to add donation amounts or membership fee payments. It's fairly basic. Well what I want to do is when I enter a new membership payment it looks to another table. If the person is currently a member,...
4
65630
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 a record inserted into the subform's table, with date created and some information from the main table inserted into the proper fields in the subform. After the record is inserted, the data entry operator enters a Date Of Service and a billing...
3
4497
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 tblPurchases, with PurchaseId, CustomerId and ProductId I created a form with a subform which shows all the customers, one at a time
2
1844
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 CompletionDate which is near the beginning of all the fields, I would like the current project to appear in the subform which lists all the finished projects. I can't save the current project at that point because I wouldn't be able to use the Undo button...
1
4433
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 created a MainTable (and related form), which has an associated SubForm (popup) along with its underlying, separate Table. The tables' relationship is one to many respectively. The primary key
1
4262
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 this to be code which is entered into the form, rather than as a property of the field in the table because there is other data which is entered before. This data is entered in at a later date.
1
1493
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 under Order By I entered the following: SATermDate DESC, CMSTermDate DESC, SATermDateRescinded DESC,
5
6982
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 to complain about nulls and then about 'can't repeat an index'. To solve this I wrote code on the main form's subform enter event (I'm surprised I found it. I must have spent an hour trying to program the enter and exit events from the subform...
5
3451
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: default.aspx:
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8504
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6169
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.