Lose features on opening Access 2002 db in Access 2003

M

Mac

I have an application that has been running great in
Access 2002. When I open it in Access 2003 it takes away
one of the critical features I had. Namely on a subform I
had a combo box with a drop down list that allowed a user
to go directly to the another record without having to
scroll through all of the records. The code is fairly
simple and is given below. When I open the db in 2003, I
no longer can use the combo box, in fact if I go and look
at the code for that procedure it has been eliminated.
How do I go about changing the code so that I can have a
similar feature as before. Here is the code:
Private Sub Combo28_Afterupdate()
Dim rs as Object
Me.Refresh
Set re= "[Id] = '"& Me![Combo28]& "'"
If Not re.eof Then Me.bookmark = rs.Bookmark
End Sub

How can I make this work. Jack
 
A

Allen Browne

The fact that the code was removed suggests that your A2002 mdb was
partially corrupt. It may benefit from a decompile.

When you add a combo box to your form, there is a wizard that will write
this code for you. However, the following is better. Be sure to add error
handling.

Private Sub Combo28_AfterUpdate
If Me.Dirty Then 'Save before move.
Me.Dirty = False
End If
If Not IsNull(Me.Combo28) Then
With Me.RecordsetClone
.FindFirst "[Id] = """ & Me.Combo28 & """"
If .NoMatch Then
Beep
Else
Me.Bookmark = .Bookmark
End If
End With
End If
End Sub

Note: if Id is a Number field (not a Text field), drop the extra quotes,
i.e.:
.FindFirst "[Id] = " & Me.Combo28
 
Top