RUNNING A PROCEDURE AFTER MAXIMIZING A FORM

  • Thread starter bifteki via AccessMonster.com
  • Start date
B

bifteki via AccessMonster.com

Is there any way of referring to the maximize event -which, as far as I found
out, doesn't actually exist as en event in Access? The only somehow relevant
event I could find was the resize one but I found out it only occurs after
the opening of a form or by changing the size of the form in a macro or event
procedure.
To be more specific, I want a textbox to be "maximized" along with the form.
 
D

Douglas J. Steele

What does maximizing a textbox mean?

You could try checking the form's Height and Width properties in the Resize
event. You can put code that'll run if they've reached whatever size is
appropriate for Maximized.
 
B

bifteki via AccessMonster.com

Douglas said:
What does maximizing a textbox mean?


What I want to do is make the text box grow in proportion to the form. This
means it will always be, let's say, the form's width minus 10 cm. The problem
isn't how to do that but where to put the code - all 's fine with what you
told me but the code must run every time the max button on the menu bar is
clicked. I just can' t find the appropriate event.
You could try checking the form's Height and Width properties in the Resize
event. You can put code that'll run if they've reached whatever size is
appropriate for Maximized.

The resize event doesn't work with what I want because it occurs every time
a form is opened or resized via an event procedure or a macro (according to
the corresponding help text) -it doesn't occur when you maximize the form
through the form's max button.
 
D

Douglas J. Steele

Yes, the Resize event occurs every time the form is opened or resized.
That's why you have to put in a check to determine whether or not it's
appropriate to run your code to change the textbox.

AFAIK, there's no other event that you can use.
 
R

Rick Brandt

bifteki via AccessMonster.com said:
What I want to do is make the text box grow in proportion to the form. This
means it will always be, let's say, the form's width minus 10 cm. The problem
isn't how to do that but where to put the code - all 's fine with what you
told me but the code must run every time the max button on the menu bar is
clicked. I just can' t find the appropriate event.


The resize event doesn't work with what I want because it occurs every time
a form is opened or resized via an event procedure or a macro (according to
the corresponding help text) -it doesn't occur when you maximize the form
through the form's max button.

Um, yes it does. I just tested this by placing a MsgBox function in the resize
event and it definitely showed up when I maximized the form.
 
B

bifteki via AccessMonster.com

Yeah... Well, it turned out I was wrong. I had put some test code inside the
resize sub but I must have done some small mistake cause it didn't execute
and so I thought it didn't even enter the procedure. Now I just wrote a line
for a msgbox to appear & it does. The problem is that at first I thought it
didn't run because the code I've wrote to change the textbox's size does
nothing. Now I guess there's something missing? Anyway, here 's the code.

Private Sub Form_Resize()
Dim descrWidth As Integer
Dim formWidth As Integer
Dim t As Integer

formWidth = Forms!frm_Contacts.Width
descrWidth = formWidth - 4200
txt_description.Width = descrWidth
End Sub

I 've also noticed that the form's width in the property sheet doesn't change
when I maximize the form, so I guess that 's why the textbox's width doesn't
change either.
 
B

bifteki via AccessMonster.com

OK I found out what I must do. I must refer to the WindowWidth cause the
form's width remains the same. Thank you both for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top