Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Current event not triggering on a recordset.findfirst

Status
Not open for further replies.

herbivorous

Technical User
Mar 28, 2002
32
US
I am working on a form with customer information that includes a subform that lists all customers to ease searching. When you click on a record in the subform (which just shows names, etc.), the data in the main form (address, and other info) syncs and everything is lovely.

My difficulty is with a text box I've added to the main form that finds records in the subform. I have set it up such that as you type in the search window, the subform scrolls to the best match -- type H and you get the first of the Hs, then E and you're to Heller, maybe, and then R and maybe you reach Herbert or Herbivorous. All fine, after some trial and error, using the recordset findfirst method.

However, the main form, whose update is triggered by an OnCurrent event procedure in the subform, does not update in response.

Is there a way to artificially trigger the current event, or to call that private sub? Or to even embed that procedure in my current procedure (since they are in different forms, a cut and paste approach doesn't seem to work.)

I'll paste my procedure here, in case it provides any clues

Private Sub searchwindow_KeyUp(KEYCODE As Integer, Shift As Integer)
Dim rst As DAO.Recordset, strCriteria As String
strCriteria = "[findname] Like '" & searchwindow.Text & "*'"
Set rst = Form_frmSearchNames.Recordset
rst.FindFirst strCriteria
Me!searchwindow.SetFocus
Me!searchwindow.SelStart = 99
End Sub

I'm a self-taught trial and error programmer, so this may all be ass-backward. It wouldn't be the first time. . .
 
Set rst = Form_frmSearchNames.RecordsetClone
rst.FindFirst strCriteria
If Not .NoMatch Then
Me.Bookmark = rst.Bookmark
End If
...

try it...

[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Thanks. I was playing with the Clone property for a while, but not getting anywhere, so I had abandonded it. Now that I've got my other issues worked out, maybe I can slip it in without grief. I did find a pretty obvious work-around, but this looks cleaner -- I'll give it go. I never have been good at leaving well enough alone.
 
Actually, the current event still doesn't seem to trigger on the record change on the subform. But this solves another "feature" that I had decided not to worry about -- the reaction when a matching record isn't found. Along with my obvious, simple solution to the initially posed problem (I was trying to overthink it, better now thanks), I'm rolling. I appreciate your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top