gojets1721
Registered User.
- Local time
- Yesterday, 19:52
- Joined
- Jun 11, 2019
- Messages
- 429
Bit of an odd question........so I have DB full of complaints dating back years. My main form which looks at one complaint at a time has onload code (see below) so that it automatically only opens complaints from 2022.
Elsewhere in the DB, I have a button that I want to open the form using different criteria and I'm using a where condition to do that (see below code). But since I also have onload code, it (understandably) ignores the where condition and opens the form using the onload code.
Before I change things around, I wanted to see if there was an way around this. Probably not, as access is behaving how it should but I thought I'd at least check.
Thanks!
Onload code:
Where condition code from openform button:
Elsewhere in the DB, I have a button that I want to open the form using different criteria and I'm using a where condition to do that (see below code). But since I also have onload code, it (understandably) ignores the where condition and opens the form using the onload code.
Before I change things around, I wanted to see if there was an way around this. Probably not, as access is behaving how it should but I thought I'd at least check.
Thanks!
Onload code:
Code:
Private Sub Form_Load()
Me.Filter = "YEAR([ComplaintDate])= 2022"
DoCmd.SetOrderBy "[ComplaintDate] ASC"
Me.FilterOn = True
End Sub
Where condition code from openform button:
Code:
Private Sub txtInProgressComplaints_Click()
DoCmd.Close acForm, "frmLaunch"
DoCmd.OpenForm "frmComplaints", acNormal, "", "Status = 'In Progress'", , acNormal
End Sub