Full Version: Form size change through VBA?
UtterAccess Forums > Microsoft® Access > Access Forms
YZF
Hello, i would like to write code in VBA for my form, where after button click , the size of my form would change...
How do i do that?
In fact i want to have a form, and a subform in it (below my form), and when i press button, form window would become bigger and subform would become visible. I managed to do the second part, but now i need to make form size change (size of window i guess...)
Thanks
MrSiezen
Hi!
se this command.
DoCmd.MoveSize [Right], [Down], [Width], [Height]
These values are in Twips (567 Twips = 1 cm)
HTH
YZF
Thnx!
MrSiezen
You're welcome!
YZF
And another question, if i want to change the position of some object in my report, how could i do that?
After button press, i want to move one text box in my report, lower..
Thnx
MrSiezen
You can't move a control be code, AFAIK...
YZF
Well it could be not by button press, but maybe by some conditions, e.g. if textbox = 0 then put it in different place, else leave it in default place. When you create your report.
MrSiezen
What you could do is:

Create two controls with the same control source instead of just one, and put them on both places where you want them to be.

Now put something like this in the OnCurrent event of your form (or report?):

If YourCriteriaTextbox = 0 Then
AlternativelocationTextbox.Visible = True
NormallocationTextbox.Visible = False
Else
AlternativelocationTextbox.Visible = False
NormallocationTextbox.Visible = True
End If

Good Luck
Edited by: MrSiezen on Mon Dec 19 8:03:45 EST 2005.
YZF
Yes, this is good idea! I'll give it a try, thnx frown.gif
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.