Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / July 2006

Tip: Looking for answers? Try searching our database.

DoCmd.Save Error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee Allen - 05 Jul 2006 16:00 GMT
I recently converted an Access 97 Application to Access 2003.

When I use this forms combo box, I get the f ollowing error in a dialog box
"RUN TIME ERROR 2501 the save action was cancelled",

when I update the combo box for which the beforeUpdate Code is below, the
debugger screen goes directly to the line about DoCmd.Save in the code below.

Private Sub cmbTreatment_BeforeUpdate(Cancel As Integer)
   Dim rstTreatment As Recordset
   
   Set dbs = CurrentDb
   i = vbOK
'If Me.cmbTreatment.Value <> Me.cmbTreatment.OldValue Then
   If Len(strHNickname) > 0 Then
       i = MsgBox("This action will replace the current treatment, do you
wish to continue?", vbOKCancel)
   End If

   If Len(strHNickname) < 1 Or i = vbOK Then
       Set rstTreatment = dbs.OpenRecordset("Select TREATMENT,NICKNAME from
tbl_Treatment where trim(NICKNAME) = '" & Trim(Me.cmbTreatment.Value) & "'")
       If rstTreatment.RecordCount > 0 Then
           Me.TREATMENT = rstTreatment("treatment")
           Me.TREAT_NICK_NAME = rstTreatment("nickname")
'            Me.cmbTreatment.Text = rstTreatment("nickname")
           DoCmd.Save
           strHCase = Me.CASE_ID
           lNoEdit = True
           Me.oleTreatment.Value = rstTreatment("treatment")
'            Me.cmbTreatment.Text = rstTreatment("nickname")
       End If
   Else
'        Call LoadCaseFields
       Me.oleTreatment.Value = Me.oleTreatment.OldValue
   End If
'End If

End Sub

Any Ideas?

Lee
Steve Schapel - 06 Jul 2006 10:24 GMT
Lee,

DoCmd.Save refers to changes to the design of the current database
object.  It is not relevant to your data.  It normally would be applied
when the form is in Design View, not when you are in the middle of
manipulating data and the value of controls.  If you are intending to
save the current record, then the applicable method would be...
 DoCmd.RunCommand acCmdSaveRecord

Signature

Steve Schapel, Microsoft Access MVP

> I recently converted an Access 97 Application to Access 2003.
>
[quoted text clipped - 39 lines]
>
> Lee
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.