You could open it and set it's visible property to No and then change the other properties as necessary and then close it.
However, changing the values in code this way would be temporary. Any property settings would be reset to what they were the last time they were changed in design view when you close the form.
I believe it is possible to do what you want but that is beyond my skill level.
Larry De Laruelle
larry1de@yahoo.com
I have the problem that I change the form's properties
1. RecordSource
2. Filter
3. OrderBy
one after the other resulting in the form being requeried three times automatically. How can I change the properties with the form being closed so the user doesnt have to watch all those requery flashes....?
Can you give a more thorough example? Presumedly if you are chaning the recordsource of a form, it is because you are reacting to a user-driven event... that is, the user has, for example, selected an option button to change the order by clause of your recordset from ascending to descending. If that is the case try turning off screen updating, (Application.Echo = False) so that the screen doesn't flicker during the requery... and then turn updating back on once the requery has finished (Application.Echo = True). You can couple this with the hourglass (DoCmd.Hourglass = True) so that the user knows something is happening during the brief pause.
Again, if you can give a more concrete example (stating the context and form state) I'd be happy to help you with the code.
The user is filtering the data over a control bar. The first control affects the recordsource, the next ones build together an additional filter, some buttons reorder the entries while one button clears the whole scenario to standard values. When I called the form the first time it was requeried 6 (!) times (1. form properties, 2. new recordsource, 3. new filter, 4. new orderby, 5. + 6. ??), when you cleared the values it was 3 times.... quite some requery flashing for the poor user.
application.echo false/True works perfect! thanks a lot!
One caveat regarding Application.Echo = True/False... you NEED to make sure that you have bulletproof error handling in your code. If an error is generated in your code while the Echo state is False, the end user will never see the error and the program will appear to hang indefinitely (becuase the screen is not updating)!
ISN'T IT BETTER TO USE A QUERY TO SELECT THE RECORDS NEEDED, INCLUDING THE ORDER BY CLAUSE, MAYBE BY THAT WAY DEPENDING ON SEVERAL THINGS RELATED TO YOUR DESIGN AN YOU SYSTEM REQUIREMENTS YOU ALSO MAY NOT NEED SEVERAL TABLES INSTEAD A SINGLE ONE, USING THE APROPIATE FIELDS AS CRITERIA YOU CAN SELECT THE DATA THAT YOU NEED.
Unfortunately the data design is so complex that I need both ... really long queries including where clauses plus form filters. Adding the ORDER BY to the sql text on-the-fly is practically impossible, way too complex and dangerous
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.