PDA

Click to See Complete Forum and Search --> : Change to a subform


vonoventwin
Apr 14th, 2006, 02:25 PM
I want this code to be written for a subform and I don't know how to rewrite it... I've tried Me.form1.form.filter = but that doesn't work. The forms name is form1 and I have no idea how to get the filter to work on it. Thanks!


Private Sub Form_Load()
If lngMyEmpID = 0 Then
DoCmd.ApplyFilter , "Squadron IN('MXS','AMXS','MOF')"

ElseIf lngMyEmpID = 1 Then
DoCmd.ApplyFilter , Squadron = "RQW_HQ"

ElseIf lngMyEmpID = 2 Then
DoCmd.ApplyFilter , "Squadron IN('101','102','103','OG_HQ','OSF')"

ElseIf lngMyEmpID = 3 Then
DoCmd.ApplyFilter , "Squadron IN('MSG_HQ','MSF','SFS','SVF','LRS','CES','CF','MDG')"
End If
End Sub

MartinLiss
Apr 14th, 2006, 02:47 PM
Since this is VBA code I've moved your thread here.