Forum Discussion
Tony2021
Dec 07, 2021Steel Contributor
OpenArgs
Hello, I have a form frmLetterOfCredit that the is opened in 1 of 2 ways. 1. From frmProjects . If from frmProjects I grab the ProjID and filter frmLetterOfCredit On Load 2. I can also open ...
- Dec 07, 2021
Hi,
1. Try to set the form's property FilterOnLoad to False. If that doesn't help, then
2. Instead of Filter="", try this in the OnLoad event of the form:
Me.FilterOn = False
Servus
Karl
*********
Access-Entwickler-Konferenz: https://www.donkarl.com/?AEK
Access DevCon: http://AccessDevCon.com
Access FAQ (de/en): https://www.donkarl.com
arnel_gp
Dec 07, 2021Steel Contributor
You can also test for Parent property of the form (meaning it is a subform of some Parent form).
Private Sub Form_Load()
Dim varParent As Variant
On Error Resume Next
Set varParent = Me.Parent
If Err Then
Err.Clear
Me.Filter = ""
Me.FilterOn = False
Exit Sub
End If
On Error Goto 0
If Len(Me.OpenArgs & "") > 0 Then
Me.Filter = "[ProjIDfk] = " & Split(Me.OpenArgs, ";")(0) 'I use to have >1 field and had a need for "split" but kept as is
Me.FilterOn = True
Else
Me.Filter = "" 'this doesnt seem to turn the filter off and I want to be triggered if opening frmLetterOfCredit directly and not from frmProjects
Me.FilterOn = False
End If