Minggu, 04 Januari 2026

Re: [MSAccessProfessionals] Access forms animation problem

Hi Hassan,

 

If you Debug > Compile your code, the compiler will point out that Left is not a property of Me (the Form object).

 

Try the Move method instead. It will allow you to size and position your form.

 

Best Regards,

 

-Tom.

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Hassan Vedadian via groups.io
Sent: Sunday, January 4, 2026 2:14 AM
To: MSAccessProfessionals@groups.io
Subject: [MSAccessProfessionals] Access forms animation problem

 

target: frmMain to start as small icon at bottomLeft slowly go to right, 

then to screen center, then expands to fits full size. 

Code is below:

------------------------------------------------------------------------

 

Option Compare Database
Option Explicit

Private animStage As Integer
Private easing As Double

Private Sub Form_Load()
    easing = 0.18
    animStage = 1

    ' Start bottom-left
    Me.Left = 0
    Me.Top = Application.CurrentProject.Height - Me.Height

    Me.TimerInterval = 15
End Sub

Private Sub Form_Timer()
    Dim dx As Long
    Dim dy As Long
    Dim targetLeft As Long
    Dim targetTop As Long

    Select Case animStage

        ' Move right (ease)
        Case 1
            targetLeft = (Application.CurrentProject.Width - Me.Width) \ 2
            dx = targetLeft - Me.Left
            Me.Left = Me.Left + dx * easing

            If Abs(dx) < 20 Then animStage = 2

        ' Move up (ease)
        Case 2
            targetTop = (Application.CurrentProject.Height - Me.Height) \ 2
            dy = targetTop - Me.Top
            Me.Top = Me.Top + dy * easing

            If Abs(dy) < 20 Then animStage = 3

        ' Final snap + stop
        Case 3
            Me.Left = (Application.CurrentProject.Width - Me.Width) \ 2
            Me.Top = (Application.CurrentProject.Height - Me.Height) \ 2
            Me.TimerInterval = 0
    End Select
End Sub

--------------------------------------------------------

But I get the error of "data member not found" please help if possible.

Will be grateful. 

Sasson Vedadian

 

Tidak ada komentar:

Posting Komentar