Returning Focus after Rquery in Continuous Form

  • Thread starter Thread starter TonyT
  • Start date Start date
T

TonyT

Hi,

I have a Continuous Form, with a Command button (Command1)
on each line that opens another Dialog Form allowing
changes to the underlying Table that the main Form draws
it's data from (via a 'Count' Query).

When the Dialog Form closes I have to then apply a
me.Requery by code to reflect the changes made, this
however returns the focus to the Command Button on the 1st
line of the Continuous Form.

Is there a way around this? ie to return the focus to
Command1 on the current row of the continuous form?

Hope that made sense,

TonyT.
 
TonyT said:
I have a Continuous Form, with a Command button (Command1)
on each line that opens another Dialog Form allowing
changes to the underlying Table that the main Form draws
it's data from (via a 'Count' Query).

When the Dialog Form closes I have to then apply a
me.Requery by code to reflect the changes made, this
however returns the focus to the Command Button on the 1st
line of the Continuous Form.

Is there a way around this? ie to return the focus to
Command1 on the current row of the continuous form?

You have to search for the original after the requery.
Here's the general idea (assuming the table's primary key is
an aoutonumber or long integer):

Dim lngPK As Long
lngPK = txtPK
DoCmd OpenForm . . .
Me.Requery
With Me.RecordsetClone
.FindFirst "PK = " & lngPK
If Not .NoMatch Then
Me.Bookmark = .BookMark
End If
End With
 
Back
Top