View Full Version : setfocus


bry
11-06-2001, 12:04 AM
Hi all,

Can anybody help me!

I have a main form called "network data form_2" with 2 subforms called, "Material subform" & "Pipe diameter subform".
What i whant to do is for a control called "network info source" (which is on the main form) to get the focus when a
field in "material subform" is Null.

This is what i have got at the moment and i keep getting errors.


Private Sub Pipe_Material_LostFocus()
If IsNull(Me.[pipe material description]) Then
'Me.Detail.[network info source].SetFocus
Form.[Network data form_2].[network info source].SetFocus
End If
Me.Parent.[Pipe diameter Subform].SetFocus
End Sub


Thanks bry.

ott
11-06-2001, 10:22 AM
Try this:

Private Sub Pipe_Material_LostFocus()

If IsNull(Me![Material Subform].Form![pipe material description]) Then
Me![network info source].SetFocus
End If

End Sub

bry
11-07-2001, 01:19 AM
No, that doesent work either ott.

I've tried many variations but seem to keep getting this message:-

Run-time error '438'
Object doesnt support this property or method

Thanks,

bry

bry
11-07-2001, 02:19 AM
Got IT! - Thanks for looking at it everyone.
I had to create a macro to do what i wanted, the converted it to VB, then i just pasted the code and BINGO!

Thanks,
bry - here is the code

Private Sub Pipe_Material_LostFocus()
If IsNull(Me.[pipe material description]) Then

DoCmd.OpenForm "Network data form_2", acNormal, "", "", , acNormal
DoCmd.GoToControl "network info source"


Else: Me.Parent.[Pipe diameter Subform].SetFocus
End If