A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Form_Update event (Before or After)



 
 
Thread Tools Display Modes
  #1  
Old January 8th, 2009, 03:25 AM posted to microsoft.public.access.forms
Mohammad HABIB
external usenet poster
 
Posts: 1
Default Form_Update event (Before or After)

Hi

I used a date field that should automatically update as of NOW() when update/change any objects on the form. But it is not working as I expect, when I open the form it update the date field as of NOW() even if I don't do anything on the form objects. I used Form_BeforeUpdate event for the form. I try to get Form_AfterUpdate event which give me message "you entered an expression that has an invalid reference to the property".

I linked references :
1. VB for Application
2. MS Access 11.0 object library
3. MS DAO 3.6 object library
4. MS Activex Data Object 2.8 library
5. OLE Automation

What should I do! Should I need any more reference link for this purpose! I need this updated date field to track the record status.


I appreciate your kind cooperation in advance.

regards

Habib

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com/default.aspx?ref=ng
  #2  
Old January 8th, 2009, 03:48 AM posted to microsoft.public.access.forms
Gina Whipp
external usenet poster
 
Posts: 3,500
Default Form_Update event (Before or After)

Mohammad,

I put it here...

Private Sub Form_Dirty(Cancel As Integer)
Me.DateFieldYouWantModified = Now()
End Sub

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

Mohammad HABIB wrote in message
...
Hi

I used a date field that should automatically update as of NOW() when
update/change any objects on the form. But it is not working as I expect,
when I open the form it update the date field as of NOW() even if I don't
do anything on the form objects. I used Form_BeforeUpdate event for the
form. I try to get Form_AfterUpdate event which give me message "you
entered an expression that has an invalid reference to the property".

I linked references :
1. VB for Application
2. MS Access 11.0 object library
3. MS DAO 3.6 object library
4. MS Activex Data Object 2.8 library
5. OLE Automation

What should I do! Should I need any more reference link for this purpose!
I need this updated date field to track the record status.


I appreciate your kind cooperation in advance.

regards

Habib

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com/default.aspx?ref=ng



  #3  
Old January 8th, 2009, 03:53 AM posted to microsoft.public.access.forms
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default Form_Update event (Before or After)

On Wed, 07 Jan 2009 19:25:20 -0800, Mohammad HABIB wrote:

This is most likely not a References problem.

You say that the date field updates when you open the form. I am
assuming you don't want that. You need to find the code that makes
that happen. If I had to debug that I would look in the Form_Open,
Form_Load, and Form_Current event. Also check the control properties:
you could have an expression in the date_control.ControlSource.

To check if the Form_BeforeUpdate code works, set a breakpoint and
step through.

-Tom.
Microsoft Access MVP



Hi

I used a date field that should automatically update as of NOW() when update/change any objects on the form.
But it is not working as I expect, when I open the form it update the date field as of NOW() even if I don't do anything on the form objects.
I used Form_BeforeUpdate event for the form. I try to get Form_AfterUpdate event which give me message
"you entered an expression that has an invalid reference to the property".

I linked references :
1. VB for Application
2. MS Access 11.0 object library
3. MS DAO 3.6 object library
4. MS Activex Data Object 2.8 library
5. OLE Automation

What should I do! Should I need any more reference link for this purpose! I need this updated date field to track the record status.


I appreciate your kind cooperation in advance.

regards

Habib

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com/default.aspx?ref=ng

  #4  
Old January 8th, 2009, 12:47 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default Form_Update event (Before or After)

On Wed, 07 Jan 2009 19:25:20 -0800, Mohammad HABIB wrote:

Hi

I used a date field that should automatically update as of NOW() when
update/change any objects on the form. But it is not working as I
expect, when I open the form it update the date field as of NOW() even
if I don't do anything on the form objects. I used Form_BeforeUpdate
event for the form. I try to get Form_AfterUpdate event which give me
message "you entered an expression that has an invalid reference to the
property".

I linked references :
1. VB for Application
2. MS Access 11.0 object library
3. MS DAO 3.6 object library
4. MS Activex Data Object 2.8 library 5. OLE Automation

What should I do! Should I need any more reference link for this
purpose! I need this updated date field to track the record status.


I appreciate your kind cooperation in advance.


BeforeUpdate is the best event for this. Are you sure you didn't also
set a DefaultValue for that field in the table or for the control on the
form? In that case the BeforeUpdate code will still work. It will just
replace the default value when you save.


--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.