Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old May 9th, 2008, 03:50 AM
Spand Spand is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 12 Spand User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 43 m 21 sec
Reputation Power: 0
Question Forms - Problem with Form_before update event

Hi guys, the following 2 peices of code work fine only if the other doesn't exist!

The first is to ask if the user wants to save the changes before updating the form. If i say "yes", everything works fine. but if i say "No", i get the error msg "You cant go to the specified record", and problem is shown with the following line in subroutine Refresh_Click():
DoCmd.GoToRecord , , acNewRec

Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & "Do you wish to save the changes?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
'do nothing
Else
DoCmd.RunCommand acCmdUndo
End If
End Sub



Private Sub Refresh_Click()
DoCmd.GoToRecord , , acNewRec
cboSize2.Visible = True
cboRun_pipe.Visible = True
txtSchedule2.Visible = True
End Sub

Reply With Quote
  #2  
Old May 9th, 2008, 07:58 AM
sbenj69's Avatar
sbenj69 sbenj69 is offline
Dark Sonic Apprentice :D
Click here for more information. Click here for more information
 
Join Date: Feb 2007
Location: Redneck part of Illinois
Posts: 1,296 sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)sbenj69 User rank is General (90000 - 100000 Reputation Level)  Folding Points: 137454 Folding Title: Super Ultimate Folder - Level 1Folding Points: 137454 Folding Title: Super Ultimate Folder - Level 1Folding Points: 137454 Folding Title: Super Ultimate Folder - Level 1Folding Points: 137454 Folding Title: Super Ultimate Folder - Level 1Folding Points: 137454 Folding Title: Super Ultimate Folder - Level 1Folding Points: 137454 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Weeks 3 Days 1 h 46 m 58 sec
Reputation Power: 984
you can't undo something that hasn't been saved yet. Put that in the afterupdate.
__________________
Did I help you? If so gimme rep by clicking on the at the top right corner of this post

Madness does not always howl. Sometimes, it is the quiet voice at the end of the day saying, "Hey, is there room in your head for one more?"

Reply With Quote
  #3  
Old May 12th, 2008, 02:27 AM
Spand Spand is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 12 Spand User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 43 m 21 sec
Reputation Power: 0
Unhappy

Quote:
Originally Posted by sbenj69
you can't undo something that hasn't been saved yet. Put that in the afterupdate.


Hi ben,
thanks for ur reply. I'm afraid putting that code in after update is not solving the problem.
It's jus displays an extra msgBox which tells the user that "you are about to delete a record. continue?"

and again the same issue on selecting "Yes"

Reply With Quote
  #4  
Old May 12th, 2008, 02:00 PM
dykebert dykebert is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 16 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 10 m 19 sec
Reputation Power: 0
If I remember correctly you simply want to set Cancel = True in your beforeUpdate to cancel the update.

Reply With Quote
  #5  
Old May 12th, 2008, 10:14 PM
Spand Spand is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 12 Spand User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 43 m 21 sec
Reputation Power: 0
Thumbs up

Quote:
Originally Posted by dykebert
If I remember correctly you simply want to set Cancel = True in your beforeUpdate to cancel the update.


hi,
thanks for ur reply, yup that works .. added this code to my cmd button refresh.

If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Changes?") = vbYes Then
' do nothing
Else
cancel = True
Me.Undo
End If

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Forms - Problem with Form_before update event


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway