>I have a main form, frmMain with 2 subforms. By default, SubformSecond is
> made invisible. SubformFirst is in datasheet view.
> Before updating data in a textbox, txtPhyBal in subformFirst ,a message
> popup form opens (fired by before update event of txtPhyBal).
> On clicking an OK button on the message pop up form, the pop up form
> closes
> and subformSecond becomes visible but the focus can be anywhere on the
> subformFirst
> What I like to do is to have the focus remains at txtPhyBal in
> SubformFirst
>
> Private Sub OK_click()
> Dim lngSkey As long
> Dim rs as Dao.recordset
> With Forms!frmMain.SubformFirst.Form
> If txtboxQty>0 Then
> Forms!frmMain.SubformSecond.Form.Visible= True
> lngSkey= SubFormFirstID
> ' SubformFirstID is an autonumber.
> Me.requery
> Set rs = .RecordsetClone
> rs.FindFirst "[SubFormFirstID] =" & lngSkey
> If rs.NoMatch Then
> Msgbox "Can't find record"
> Else
> .Bookmark = rs.bookmark
> End if
> Set rs = nothing
>
> ' I think the problem lies with the 2 statements below
> Forms!frmMain.SubformFirst.Form.setfocus
> Forms!frmMain.SubformFirst.Form.txtPhyQty.setfocus
> Else
> Forms!frmMain.SubformSecond.Form.Visible= False
> End if
> End with.
> End sub
>
> Can someone please help?
>
> --
> Message posted via
http://www.accessmonster.com>