L
Lee Allen
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
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