Hey all. I've used this code in Access 2002/3 for some time and it has always worked just fine. It basically uses a timer to see how fast your computer is running through the code to ensure that it takes all computers the same amount of time to expand or animate the form's opening.
However, it doesn't seem to be working in Access 2007. The form is still opening, but it isn't gradually expanding it - it is just waiting the .35 seconds (or whatever you put in there) and then showing the form. Any ideas?
However, it doesn't seem to be working in Access 2007. The form is still opening, but it isn't gradually expanding it - it is just waiting the .35 seconds (or whatever you put in there) and then showing the form. Any ideas?
Code:
[SIZE="2"]Private Sub lbl_MainMenu_Click()
Dim start As Double
Dim lasttime As Double
Dim timeleft As Double
Dim lstart As Double
Dim lend As Double
start = Timer
Dim wait As Double
Dim hleft As Double
Dim wleft As Double
Dim totheight As Double
Dim totwidth As Double
wait = 0.35
If (Me.sub_Main_Menu.Visible) Then
Me.sub_Main_Menu.Visible = False
Else
Me.sub_Main_Menu.Visible = True
Me.sub_Main_Menu.Height = 0.0938 * 1439
Me.sub_Main_Menu.Width = 0.0938 * 1439
Me.sub_Main_Menu.Visible = True
totheight = 2.7917 * 1439
totwidth = 4.5 * 1439
Me.sub_Main_Menu.Visible = True
lstart = Timer
lend = Timer + 0.01
Do While (Timer < start + wait) And ((Me.sub_Main_Menu.Height < totheight) Or (Me.sub_Main_Menu.Width < totwidth))
lasttime = lend - lstart
lstart = Timer
timeleft = start + wait - Timer
hleft = totheight - Me.sub_Main_Menu.Height
wleft = totwidth - Me.sub_Main_Menu.Width
Me.sub_Main_Menu.Height = Me.sub_Main_Menu.Height + ((lasttime / timeleft) * hleft)
Me.sub_Main_Menu.Width = Me.sub_Main_Menu.Width + ((lasttime / timeleft) * wleft)
lend = Timer
Loop
Me.sub_Main_Menu.Height = totheight
Me.sub_Main_Menu.Width = totwidth
End If
End Sub[/SIZE]