[AccessD] Odd Form Behavior

William Benson (VBACreations.Com) vbacreations at gmail.com
Sun Dec 25 18:52:27 CST 2011


Out of curiosity Rocky (or anyone really)... is it best to allow Access to
save changes the user has made without requiring them to click a Save
button... just because they navigate off a record? I don't often use bound
forms, so I pretty much always have a Save button, but I notice that with
bound forms the changes are made just by moving off the record, unless you
rest in the Before_Update event, as I illustrate in a simplified snippet
below.

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Dirty Then
  If MsgBox("Save changes?", vbYesNo, "Upda the table with your change?") <>
vbYes Then
    Cancel = True
  Else
    TimeStamp= Now()
     LastModifiedBy = environ("UserName")
  End If
End If
End Sub


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Sunday, December 25, 2011 6:57 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Odd Form Behavior

Well that didn't take long.  Found the offending module pretty quickly.
Actually it was an offending programmer - I was updating the last modified
date in the AfterUpdate event instead of the BeforeUpdate event.  Changed to
BeforeUpdate and everybody's happy (especially the programmer). 

Thanks for the lead.

Rocky


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Benson
(VBACreations.Com)
Sent: Sunday, December 25, 2011 2:11 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Odd Form Behavior

Rocky
Is it a multiuser database?
Is the table, that the form is bound to, located in the same database?
Would it change if you bound the form to a query which pulls the fields from
that table instead of the table itself?
Would it navigate fine if you removed all form module code?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
Sent: Sunday, December 25, 2011 1:11 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Odd Form Behavior

Dear List:
 
I have a form in an Access 2003 app exhibiting some odd behavior.  The form
is bound to one table.  When anything on the form is changed, the form seems
to lock - that is, you cannot move to another record using the navigation
buttons.  Before making a change, the navigation buttons work.
 
I put a 'Save' button on the form with the one line in the click event
DoCmd.RunCommand acCmdSaveRecord which generates the unhelpful error 'Run
Time Error 2501 - The RunCommand action was canceled.'
 
If I put 'DoCmd.RunCommand acCmdSaveRecord' in the dirty event, it saves the
record but the navigation buttons are still not functional and I can't go to
design view.
 
Further, clicking 'View' and 'Design View' does not work at this point. I
have to click the 'Exit' command button on the form or File-->Close. If I
use the close button of the form I get a message "You can't save this record
at this time." although the record was saved because I added
'DoCmd.RunCommand acCmdSaveRecord' to the dirty event.
 
To eliminate the possibility that my installation of Access on this machine
got hosed, I moves the app and back end to a second machine and got the same
results. 
 
I would prefer not to use the save on the dirty event because I have an undo
button that the user likes.  But I think if someone can lead me a solution
of the navigation button thing, this will solve the save problem.
 
Any ideas?  I'm stumped.
 
MTIA
 
Rocky Smolin
Beach Access Software
858-259-4334
www.bchacc.com <http://www.bchacc.com/> www.e-z-mrp.com
<http://www.e-z-mrp.com/>
Skype: rocky.smolin
 
 
 
 
 
 
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list