Combo error

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

I receive a run-time error 2147352567 (80020009) when I up date the form and
then using the combo155 to go to advance to another record. The error in SQL
always highlights the LastModified = date in the beforeUpdate. Please show me
the error I have created.
Thank you
Private Sub Combo155_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[SSI] = '" & Me![Combo155] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.Dirty = True Then
If MsgBox("Do you wish to save the changes?", vbQuestion + vbYesNo, "Save
Record?") = vbNo Then
Cancel = True
Me.Undo
Else
LastModified = date
End If
End If
 
Nick said:
I receive a run-time error 2147352567 (80020009) when I up date the form
and
then using the combo155 to go to advance to another record. The error in
SQL
always highlights the LastModified = date in the beforeUpdate. Please show
me
the error I have created.
Thank you
Private Sub Combo155_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[SSI] = '" & Me![Combo155] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.Dirty = True Then
If MsgBox("Do you wish to save the changes?", vbQuestion + vbYesNo, "Save
Record?") = vbNo Then
Cancel = True
Me.Undo
Else
LastModified = date
End If
End If


Does this error occur if you modify the record and then go to another
record, without using the combo box?

What is "LastModified"? Is it a bound control on your form?

In general, before navigating to another record, it's a good idea to
explicitly save the current one, if it has been modified. Here's a slightly
better procedure for your combo box's AfterUpdate event:

'------ start of modified code ------
Private Sub Combo155_AfterUpdate()

' Find the record that matches the control.

If Me.Dirty Then Me.Dirty = False

With Me.RecordsetClone
.FindFirst "[SSI] = '" & Me![Combo155] & "'"
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With

End Sub
'------ end of modified code ------

But I'm not sure exactly what caused your error, so I can't guarantee that
this will solve it.
 
Back
Top