Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 25th, 2004, 06:00 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Location: , , .
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default Form Data Edits

Well my database is in the user environment. Hooray! But they presented me with a problem that I didn't think of.

The form and the controls are bound to an underlying table. When the user is in the form viewing the records, some have inadvertently change data, moved on the next record without realizing it.

I don't mind if they change the data, because they can update the data anytime in the form, but I need a way to make them aware that the data has changed in the record, do they accept the change, and also have them edit a date field in the form pertaining to the last time a change was made to that particular record.

Would I use a beforeupdate event for this type of action?

As Always very grateful, bph

Reply With Quote
  #2 (permalink)  
Old January 25th, 2004, 08:53 PM
sal sal is offline
Friend of Wrox
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do not allow your users to just change data on any form. Make sure that they view their data in reports and use forms mostly for data entry and data edits. Use ADO for data entry/edit forms. This will ensure that your users know that changes are permanent. Never allow a user to change/edit/add data with a form in datasheet view or continuous form

Do not create an application that allow a users to change data in a form by just changing the values while another form makes them click a save button. This creates confusion.

You could use the after update event to warn the user that the record will be changed, but this will fail if you do not use ADO. Access wil make the data edit even if you warn the user.



Sal
Reply With Quote
  #3 (permalink)  
Old January 25th, 2004, 09:56 PM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Location: , , .
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Sal, Thanks for the info.
I have a form which is strictly for data entry. But there's a need for the user to edit data using the form which is tied to existing records table. There are about 50 different controls on the form where the user can make a change. ADO?? whole new ball game for me.
Reply With Quote
  #4 (permalink)  
Old January 26th, 2004, 09:17 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by sal
Never allow a user to change/edit/add data with a form in datasheet view or continuous form
I rarely ever use continuous forms because they present lots of formatting problems (they usually behave all or nothing instead of per record). However, there are times when I let people edit things in datasheet view. In fact, the datasheet view is much more convenient and user-friendly in some cases. For example, if someone is entering stack parameters for an output stack and they're entering stack no., diameter, height, flowrate, etc. To see them lined up in datasheet view is more intuitive than one at a time on a form.

They way I avoid accidental saves is that the form and subform (datasheet view) are read-only until an EDIT button is pressed. At that point a label on the upper right of the form header changes from a green "VIEW" to a red "EDIT". When the user moves to the next record, everything reverts to read-only again.

Hey! I hit 200 posts! I'm a member now! I'd like to thank the Academy...

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #5 (permalink)  
Old January 26th, 2004, 09:49 AM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Location: , , .
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Congrats! I feel I have somehow helped make this possible.

Back to work. The coding oif the 'edit button' takes place where and how.

How about using the dirty event?

bph

Reply With Quote
  #6 (permalink)  
Old January 26th, 2004, 10:16 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by bph
 Congrats! I feel I have somehow helped make this possible .
 I'd like to thank all the little people that... JUST KIDDING! JUST KIDDING! :D

Quote:
quote:The coding oif the 'edit button' takes place where and how.

How about using the dirty event?
Well, no. Since the form opens read-only you can't dirty it. You have an EDIT button somewhere and you put the code on the button's On Click event.

Basically, on the form's On Current event you have:
Code:
    Me.AllowAdditions = False
    Me.AllowDeletions = False
    Me.AllowEdits = False

If you have a subform as well, then:
Code:
    Me.sfrMySubForm.Form.AllowAdditions = False
    Me.sfrMySubForm.Form.AllowDeletions = False
    Me.sfrMySubForm.Form.AllowEdits = False

On the button's On Click event you just set them all to true.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #7 (permalink)  
Old January 26th, 2004, 11:12 AM
bph bph is offline
Friend of Wrox
 
Join Date: Dec 2003
Location: , , .
Posts: 102
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks! Brings tears to my eyes to think I was there when it happened.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Related Data on A Form wb8bgy Visual Basic 2005 Basics 0 December 26th, 2005 03:43 PM
Allow Edits In SubForm tready Access VBA 1 December 19th, 2005 08:41 AM
JavaScript and Date Edits srotondo Javascript How-To 3 February 2nd, 2005 01:32 AM
Access edits kev_79 Access ASP 2 September 23rd, 2003 11:50 PM



All times are GMT -4. The time now is 11:58 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.