On form close, select in Datasheet

wrightyrx7

Registered User.
Local time
Today, 04:16
Joined
Sep 4, 2014
Messages
104
Hi all,

I have a 'main' form which has a datasheet displaying all records (Form1). And a form for Creating or Editing records (Form2).

When form2 is closed the Datasheet on Form1 refreshes and the record at the TOP of the datasheet is selected by defualt.

What i want when Form2 is closed is for the focus on the datasheet, to be on the record that was just open in form2 (search for ID).

Thanks in advance,
Chris
 
When form2 is closed the Datasheet on Form1 refreshes...
How does that work? That is not default behaviour. I would want the solution to your question to be integrated into the code or process that detects the form2 close and form1 requery. It would be an advantage if you show the code for that process so we can tweak it to add the functional you are talking about.

That said, here's a routine that finds a record on a form...
Code:
Public Sub GoToID(RecordID as Long)
   With Me.RecordsetClone
      .FindFirst "RecordID = " & RecordID
      If Not .NoMatch Then Me.Bookmark = .Bookmark
   End With
End Sub

hth
Mark
 
How does that work? That is not default behaviour. I would want the solution to your question to be integrated into the code or process that detects the form2 close and form1 requery. It would be an advantage if you show the code for that process so we can tweak it to add the functional you are talking about.

That said, here's a routine that finds a record on a form...
Code:
Public Sub GoToID(RecordID as Long)
   With Me.RecordsetClone
      .FindFirst "RecordID = " & RecordID
      If Not .NoMatch Then Me.Bookmark = .Bookmark
   End With
End Sub

hth
Mark


Thanks Mark, before I try the code I will try and figure out why the datasheet refreshes when I close the form.

If this is not normal behavior I should be able to figure it out (I hope lol).

Thanks again
Chris
 

Users who are viewing this thread

Back
Top Bottom