1

This is my code below. I am getting an error "Object doesn't support this property or method" on controls.click. Anyone there who can help?

    'create new access object
    Set appAccess = CreateObject("Access.Application")
    'open the acces project
    Call appAccess.OpenCurrentDatabase("D:\NSE Cash\db.accdb")
    appAccess.Visible = True
    With appAccess
        Application.DisplayAlerts = False
        .DoCmd.OpenForm "Form1"
        .Forms("Form1").Controls("Run").Click
    End With
    Set appAccess = Nothing
1
  • A form belongs to an open database, not to the Access application. Commented Apr 29, 2021 at 13:02

1 Answer 1

1

First, the button Click event cannot be Private - remove Private from the procedure declaration. Then, this works for me:

.Forms("Form1").Run_Click

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.