473,383 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Correct use of Dirty event

Ericks
74
I have a subform that contains several controls of which one is a date control called “DateOfInfoAdded”. The default format of this control is date() so whenever a new record is created the date is automatically set to today. But when controls on the form are edited I want a message to appear asking whether this date should be changed (to now indicate the date of editing). I know that the dirty event is involved but I wouldn’t know how and where to use it (on dirty, before update, after update, etc.of the form, the controls?) as well as how to refer to the date control to change. Certainly a piece of cake for you guys.
Jan 29 '08 #1
1 9927
Ericks
74
Well, I came up with something completely different but it seems to work. In the After update event for each control (don't laugh) I added this code:

If Me.[DateOfInfoAdded] < Date Then
Save_Response = MsgBox("You have edited the data. Do you want to change the date to today?", vbQuestion + vbApplicationModal + vbYesNo, "Save Record?")
If Save_Response = vbYes Then
Me.[DateOfInfoAdded] = Date
End If
End If

The first line is to avoid to be asked the question if the edit date is the same as the [DateOfInfoAdded].

Not "elegant" is that I put this code behind each control. When I put it in the Form's event it will trigger the message twice because it will flag the date change itself.

I'm sure the Dirty event is the right way to go so I'm still open to suggestions.
Jan 29 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jarrod Sharp | last post by:
When a user changes the text in a textbox i wish to update the registry key it represents. If I use event TextChanged event then as you type every character in your update the registry routines are...
15
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that...
3
by: Mark | last post by:
Is this the way to determine if a subform is dirty? If Me!SFrmEnterActivityList.Form.Dirty Then I use this statement in the Unload event of a form. When I click the Close button, the statement...
2
by: Salad | last post by:
A97. I have a command button to save and exit. I had the code If Me.Dirty Then Docmd.RunCommand acCmdSaveRecord ...more code endif I was getting an error because a value was not getting...
1
by: RIP662 | last post by:
Okay all you GURUS out there... here's the skinny... I need a way to prevent the Me.Dirty event to trigger after a FORM_OPEN event. What I have is a field that is dependent on another field that...
9
by: Susan Bricker | last post by:
I am currently using the OnDirty event of a Form to detect whether any fields have been modified. I set a boolean variable. Then, if the Close button is clicked before the Save button, I can put...
3
by: AussieRules | last post by:
Hi, I have heaps(50+) of text boxs on a form. I want to have an dirtyflag type property that is set when any one of the 50 text boxes is change, so that i can prompt the user to save changes...
5
by: Alain Filiatrault | last post by:
Hi, I need to implement a "form.dirty" feature on a VB .NET form not related to a database. I need to know if any of the items (Textboxes, combo, listboxes, ...) was changed. Is there a quick...
1
by: lesperancer | last post by:
I've got a form that is opened in readonly mode and no fields can be changed, great but if I click on a combo box that has an _enter() event that sets a field on my form to a value (albeit the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.