Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Form Properties 1

Status
Not open for further replies.

Kib

Programmer
May 17, 2001
58
0
0
US
Is it possible to modify a form's properties without having it open. Like changing the source or caption on a control on the form? Thanks.

Kib
 
Kib:

If you mean open in design view, the answer is yes.

You can use code to modify properties.

If you mean you want to change properties while the form is closed, why would you want to do that?

Larry De Laruelle
larry1de@yahoo.com

 
I want to modify the form's properties in code.
Based on variables that have been found
But I do not want the form that is being changed open.

Kib
 
Kib:

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

 
Has anybody figured out a way yet?

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....?

Regards
waldemar
 
Waldemar,

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.

Rock on!

Kevin
 
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!

waldemar
 
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)!

On Error GoTo Error_Handler

Application.Echo = False
Docmd.hourglass = True

'Code here....

Exit Sub

Error_Handler:

Application.Echo = True
Docmd.hourglass = False

msgbox err.number & " " err.description

End Sub

That is just a sample.... good luck!

Kevin
 
I see - thanks a lot! It makes the application look much smoother now!...

waldemar
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top