open to specific record in datasheet

deekras

Registered User.
Local time
Today, 19:48
Joined
Jun 14, 2000
Messages
169
i have a datasheet and a separate form.

basically, the datasheet is a list of members. when i double-click one particular member, a form opens where i can select a membership status from a combobox. after the combobox is filled, the datasheet is requeried to reflect the status change. this status form is not closed becuase i want the user to be able to choose if to send a letter. (it is not required to send a letter) the user can click to close the box.

but i am trying to help the user so that she does not have to click the box (everything else can be done withthe keyboard). i figured that i could do something like this:

when the user changes from one member to another (in the datasheet), the status form closes. i have that done. but now the focus is on the first record of the datasheet, not in the new record.

what can i do to set the selected record to have the focus?
 
Can i just ask why u need to use a seperate form for the status? Could u not use a combobox in the datasheet with an after update event that asks if they want to send a letter or something like that? Or do u do other stuff in the seperate form as well?

I'm assuming u have a requery or something to update the datasheet, that's why the record is moving to the first record.
Only way i can think of is before the requery, u store the current record in a variable (intCurRec = me.currentrecord). Then after the requery u do a DoCmd.GoToRecord , , acGoTo, intCurRec. So u would have something like this:
Code:
Private Sub status_AfterUpdate()
    Dim intCurRec As Integer
    intCurRec = Me.CurrentRecord
    ...
    ' Any other actions here
    ' msgbox "Send letter?" etc
    ...
    Me.Requery
    DoCmd.GoToRecord , , acGoTo, intCurRec
End Sub
 

Users who are viewing this thread

Back
Top Bottom