Skip Bisconer
Who Me?
- Local time
- Today, 14:24
- Joined
- Jan 22, 2008
- Messages
- 285
My object here is to find a record in a table then update two fields in the tabl, e RouteID and Seqence number. I need the RouteID to retain the value of PegRoute until the value of PegRoute changes. I thought I had this worked out before with the help of this forum but when I put it out to the field it didn’t function properly.
I am using an unbound Combo box to find a record on a form with the table as a row source. I am having a problem using the following code in that it doesn’t find the record until I return to the field a second time after the lookup. I need the table record to come up when the combo box is loaded.
Private Sub Combo42_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OEOO_ORDR] = " & Str(Nz(Me![Combo42], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
‘Have RouteID always retain the value of PegRoute
If Nz(Me.RouteID, vbNullString) = vbNullString Then
Me.RouteID = Me.PegRoute
Me.Requery
End If
End Sub
I am using an unbound Combo box to find a record on a form with the table as a row source. I am having a problem using the following code in that it doesn’t find the record until I return to the field a second time after the lookup. I need the table record to come up when the combo box is loaded.
Private Sub Combo42_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[OEOO_ORDR] = " & Str(Nz(Me![Combo42], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
‘Have RouteID always retain the value of PegRoute
If Nz(Me.RouteID, vbNullString) = vbNullString Then
Me.RouteID = Me.PegRoute
Me.Requery
End If
End Sub