How to LOOP a function to all forms?

Ugurovic

Registered User.
Local time
Yesterday, 19:20
Joined
Aug 22, 2008
Messages
36
Hi

I want to build a loop so I can loop 1 function to all forms. How do I do that? I want to put this loop under 1 button in the startform so that all forms get this function activated when the form is loaded.

Thanks in advance

Ugurovic
 
Can you be a bit more specific when referring to a function. Is this an Access function? Is this a custom function? What is the purpose of this function? What is the ultimate goal? A more detailed question will lead to a better response.

CodeMaster::cool:
 
Dear,

I want to apply the resize function with 1 button to all forms. When I press the button, resizing ON, when I press again, resizing OFF. ResizeForm module is from Jamie Czernik, you find that on the net.

I hope this reply will lead to the answer...

Thanks DCrake.

Kind regards

Ugurovic
 
In the OpenEvent of each form, check the status of the "resize" field on the opening form. The opening form will need to stay open as long as the application is open although it can be hidden if necessary.
 
You could start with something like
Dim frm As Form
For Each frm In Forms
 
and when you want to undo a resize, to go backwords, "press resize button" => resize, press another "undo resize button" => undo resize, what vba do I need for that to undo a resize?

thanks

ugurovic
 
Ugurovic,

Have an unbound text box store On or Off and then in the function check to see if resize is on or off and have an if statement to process off if it is on.

HTH,
Rodger
 
No, I think you don't get it. When I press the button, screen gets resized, but can I perform the resizing backwords. It's like this, I create 1 button, when I press it once, screen gets resized (step1); when I press it again, screen gets resized (step2); when I press again, screen gets resized one more (step3); now I want to maken one button more, to undo resize steps, to go from step3 to step2 and from step2 to step1 and from step1 to original size, how I'm doing that? Thank you all

Kind regards

Ugurovic
 
Have an unbound text box store On or Off and then in the function check to see

Except add another one for the previous size so you can walk through them every time you hit the button ... lets call the unbound controls txtPrevious and txtCurrent.

Code:
Select Case txtCurrent
Case 1 
     'Do Resize Action 2
     Me!txtPrevious = 1
     Me!txtCurrent = 2
Case 2
     If txtPrevious = 1 Then
        'Do Resize Action 3
        Me!txtCurrent = 3
     Else
        'Do Resize Action 1
        Me!txtCurrent = 1
     End If
     Me!txtPrevious = 2
Case 3
     'Do Resize Action 2
     Me!txtPrevious = 3
     Me!txtCurrent = 2
End Select

-dK
 
I think the simpelst solution, I say this with all the respect and thanks in the world, that you put a form with the button, resize module jamie szernik, and the code, so I can see and copy that because with just typing and saying, it doesn't work that well. Can you do that?

Regards
 
Ummm no. I don't know what you are doing on the resizing (maximizing, minimizing, changing the width & height ... if so, etc). That is left for you to do. I don't even know what or who a jamie szernik is!

Adding to a button is a simple as opening the properties of a button and clicking the OnClick() event.

Cmon now, this isn't my project ... so you have to provide some of the oomph. You wouldn't ask someone how to dig a ditch and then expect them to go outside and dig it for you while you sat back and sipped iced tea now would you?

-dK

P.S. That was rhetorical.
 
I've coded a function that gets loaded when the first form is loaded. The problem is, it only gets active on forms that is open, not opened forms don't get resized... can someone view the code please... I want to get I activated on form that aren't open yet, so if I do open it, it gets in a resized function...

Code is down below

Private Sub Form_Load()
Dim frm As Form
For Each frm In Forms
ReSizeForm frm
Next



End Sub
 
Last edited:
Correct. A form is not part of the forms collection until after it is loaded.

Several possibilities (and probably more) exist for you to auto-resize them ... you can set your function in a module and call it each time one of your forms are opened, or, you can load all of your forms invisibly, change the size, and save the new design.

Again, just a couple of options, I am sure there are more, but just off the top of my head, I can't think of any.

-dK
 
I think the best idea is to forget the "ALL resize form function", I'm just going to put in each load event the function "ResizeForm Me", and than the case is closed, every screen gets his resized shape with no problems.

Thanks Access World Forums!!

Thanks for you to keep answering my replies.

Ugurovic
 
Sorry it didn't work the way you wanted to with the limitation of the program. Am glad there was a workaround that could work.

-dK
 
No problem, you were great to help, i appreciate that!

thank you

kind regards

ugurovic
 

Users who are viewing this thread

Back
Top Bottom