|
-
Jul 18th, 2006, 12:45 PM
#1
Thread Starter
Member
Access vba form filter question
Hello,
I am working on an Access app that has a button on a form which changes the contents of a subform and applies a filter to the form in the subform. This all works fine, but the problem I have is that the filter sometimes takes a couple of seconds to complete. I would like to be able to change the cursor to hourglass while the filter is running and then change it back to normal once the filter has completed. Any ideas on which event to use?
By the way, I'm using Access 2003. Here is the code I'm currently using to open the form:
VB Code:
If (cbxNav.Value <> "Please select a destination") Then
If (cbxNav.Value = "Management") Then
Forms("frmMain").Controls("sbfrmContent").SourceObject = "frmManagement"
Else
DoCmd.Hourglass True
Forms("frmMain").Controls("sbfrmContent").SourceObject = "frmDaily"
Forms("frmMain").Controls("sbfrmContent").Form.Filter = "Status = '" & cbxNav.Value & "'"
Forms("frmMain").Controls("sbfrmContent").Form.FilterOn = True
DoCmd.Hourglass False 'this happens too soon
End If
End If
Thanks,
Ranthalion
-
Jul 18th, 2006, 12:50 PM
#2
Re: Access vba form filter question
Try it in your subforms Form_Load or in the procedure where your main form is changing its content on with, like a command button click or a record navigation change event like Form_Current.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 18th, 2006, 01:05 PM
#3
Thread Starter
Member
Re: Access vba form filter question
Thanks for the recommendations. I've tried OnLoad and OnCurrent, but the events fire before the filter is finished, causing the cursor to change back to normal before I want it to...
I want the cursor to stay hourglass until the record navigation section shows how many records are in the recordset.
-
Jul 18th, 2006, 01:08 PM
#4
Re: Access vba form filter question
Those events from the subform or parent form?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 18th, 2006, 01:10 PM
#5
Thread Starter
Member
Re: Access vba form filter question
Sorry, those are the events on the subform.
-
Jul 18th, 2006, 01:12 PM
#6
Re: Access vba form filter question
Try it in the parent form as its the one initiating the filter.
Also, try the Form_Filter and possibly the Form_AfterUpdate events.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 18th, 2006, 01:31 PM
#7
Thread Starter
Member
Re: Access vba form filter question
Thanks for your help. I just gave that a shot... No dice.
I tried just making a function and calling it during each event that fires on the parent form and on the sub form, but it doesn't seem that any event fires when the filter is finished and the navigation control is finished updating...
The apply filter and on filter events fire when I right click a field and filter on it from the subform, but not when I apply the filter through code...
The current work around I'm using now is to have a timer event on the subform that fires after 1.5 seconds, which changes the mouse pointer and disables the timer...
Let me know if you have any other ideas.
-
Jul 18th, 2006, 01:35 PM
#8
Re: Access vba form filter question
Why not code a macro to do it and then in your form you can call the macro and it can change the mouse, apply the filter, and then change the mouse back? May be a more synchronous operation.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 18th, 2006, 01:51 PM
#9
Thread Starter
Member
Re: Access vba form filter question
Good idea, but that one didn't work either. It seems that the filter is applied and completed, but the record navigation control takes a longer time to complete than the filter takes to complete. So, the data in my form changes, but the navigation control takes a little longer to calculate the total number of records and no event is raised from that control...
I suppose I could make my own navigation controls, but that just doesn't really seem worth it for this project...
Thanks again!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|