473,396 Members | 1,840 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,396 software developers and data experts.

which event? - for changes in existing records but not new records

52
Hi there,

I have a message box that I want to pop up when a user changes data in an existing record. BUT I don't want it to pop up when a new record is being started, Which event should I put this in?

I am in Access 2000, and I have set up my message box in the properties table, not in Visual Basic.

Can I sort this in the Properties table? When I go into Visual Basic - I can't find the code that matches my message box. Is everything in the database in code - I thought it was????

Thanks if you can help,

Marcella
Nov 14 '08 #1
4 1388
missinglinq
3,532 Expert 2GB
No, what's in the Properties Sheet is in the Properties Sheet, not in code, and this kind of thing will need to be done thru code.

You don't say if you want a warning if a certain piece of data is changed or if any change is made to the existing record. Assuming the latter, I think this, placed in the code module of your form, will do what you need done:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Dirty(Cancel As Integer)
  2.  If Not Me.NewRecord Then
  3.   Response = MsgBox("You are about to change data in an existing record! Would you like to proceed?", vbYesNo)
  4.    If Response = vbNo Then
  5.     Cancel = True
  6.     Me.Undo
  7.    End If
  8.  End If
  9. End Sub
When the user first attempts to change data a message pops up, asking him if this is his/her intention. If the user responds Yes, they are allowed to proceed. If they respond No, the change that has already been made (which is, in fact, only the entering or deletion of a single character) is undone.

This can be modified if it doesn't meet your exact needs.

Welcome to Bytes!

Linq ;0)>
Nov 14 '08 #2
mjvm
52
Thanks for the feedback.

What I wanted to set up was a warning that alerts the user that they have changed data in a saved record with a prompt to undo if the change is not needed.

I like what you have proposed - but can you please customise it to apply to only two fields - called [School2] and [Student Name].

In our experience, it is too easy for these fields to be inadvertently changed by a user and we need to protect that data.

I know I need to work on the naming of my database - I have been directed to the naming conventions by another expert on this forum. Can you tell me if you have any experience using the ACC Technology Renaming Wizard?

Regards,

Marcella
Nov 15 '08 #3
missinglinq
3,532 Expert 2GB
That's an entirely different can of worms, but doable, of course.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2. If Not Me.NewRecord Then
  3.  
  4.  If Me.School2.Value <> Me.School2.OldValue Then
  5.   Response = MsgBox("You are about to change data in the School2 Field! Do you wish to proceed?", vbYesNo)
  6.   If Response = vbNo Then
  7.    Me.School2.Value = Me.School2.OldValue
  8.   End If
  9.  End If
  10.  
  11.  If Me.Student_Name.Value <> Me.Student_Name.OldValue Then
  12.   Response = MsgBox("You are about to change data in the Student Name Field! Do you wish to proceed?", vbYesNo)
  13.   If Response = vbNo Then
  14.    Me.Student_Name.Value = Me.Student_Name.OldValue
  15.   End If
  16.  End If
  17.  
  18. End If
  19. End Sub
Note that when a control's name has a space in it, like "Student Name", Access VBA places an underscore in it to replace the space. So in code, it has to be referred to as Student_Name.

Sorry, I've never even heard of the ACC Technology Renaming Wizard.

Linq ;0)>
Nov 15 '08 #4
mjvm
52
Thank you! That has worked beautifully just the way I wanted it to!


Thank you for all your help.
Nov 15 '08 #5

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

Similar topics

1
by: David Bear | last post by:
I would like to develop some tools to better understand/analyze windows event logs. What I've done is export the event log as a delimited file, then try to use awk or python to parse the info....
10
by: heromull | last post by:
We have an asp.net app with about 200 data entry forms. Customers may enter data into any number of forms. Each form's data is persisted in a corresponding sql table. When data entry is...
6
by: P | last post by:
Hi, I have a form with several controls. One of them is initialized through VB in frm_current. I am using the frm_beforeupdate event to prompt users for saving changes. How can I make it so that...
5
by: Sean Byrne | last post by:
We have a Microsoft Access 2000 database consisting of 20 tables covering 20 different events. In each table, there are 3 Team members, a date of the event and several unique fields for the event,...
4
by: Richard Sherratt | last post by:
Access 97 and SQL Server 2000. Reports in this system are driven from a parameter form. Parameters are used to make a WHERE clause. If no parameters are selected, strWhere is a zero length...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
34
by: Jeff | last post by:
For years I have been using VBA extensively for updating data to tables after processing. By this I mean if I had to do some intensive processing that resulted in data in temp tables, I would have...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
2
by: maxx429 | last post by:
Hi all, I am a VBA newb. I know probably just enough to be dangerous. :) Anyway, I have a Form that I am using <a href="http://allenbrowne.com/AppAuditCode.html">Allen Brown's Audit Trail</a> ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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
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...
0
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...
0
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,...

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.