Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access VBA Trigger code in form when text box is populated from another form

Hi

In Access I have a pop up form that I use to populate a text box in my main form. I need to trigger code in the main form itself when the text box changes. I do not want to do it in the pop up form as this form is used all over the system

User generated image

Open in new window

Avatar of Jonathan Kelly
Jonathan Kelly
Flag of Ireland image

Hi,

First make the function on your main form Public.
Then you can call it from another form with something like the following:
Forms!AnotherForm.YourCommand
SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks. I got "method or data member not found" and the word "currentproject" part was highighted
Hi Dale. I used the following code but it doesn't get to the last line, which is what I need. Am I missing something?

    Me.LicenceNo.Visible = True
    oForm = Me.Name
    oTextBox = Me.LicenceNo.Name

    DoCmd.OpenForm FormName:="f_List_Licence", windowmode:=acDialog

    If CurrentProject.AllForms("f_List_Licence").IsLoaded = False Then
       Exit Sub
    End If
   
   Call LicenceNo_AfterUpdate
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks very much Dale
Glad to help, Murray, it's been a while since I've had the time to contribute much here on EE.

Dale