Open one Form from Another and transfer Data

Passing Form Values

A common requirement is to pass values from one form to another. In these videos I demonstrate some problems you might face, and demonstrate a good and robust way of doing it.

Open One Form From Another

Open One Form From Another

Video 1 (3:15)

have used the technique shown here, for many years. I find it is very flexible, also, quick and easy to copy from one Form to another.

In the sample database I use this code:-

				
					Private Sub btnOpenForm2_Click()
Dim strFrmName As String
strFrmName = "Form2"
    
    DoCmd.OpenForm strFrmName
        With Forms(strFrmName)
           '.btnOnForm2.Enabled = True
           '.fSetUp ("Sample Parameter")
           '.Caption = "I CAN CHANGE THE CAPTION"
        End With

End Sub
				
			

… to open the form and directly and access the properties of the command button.

I have deliberately left items (the commented out lines) in the code so you can get an idea of what’s possible by using this method.

For example this line here ‘.fSetUp  calls the function “fSetUp” which is a public function within the form you are opening.  If you un comment that line it will calls a function and you can see how it works.

This is a very powerful way of controlling what happens when you open another form….

You can also provide function parameters which provide one method of Passing values through to the form you are opening…

Video 1 (3:15)

Nifty Access YouTube Thumb Nail
Play Video

Related Links:-

Tags to help me find this piece of code:-

#With End With #Open Form #OpenForm #fSetUp

… …

Form Load, Activate, Open, Issue 

Form Load, Activate, Open, Issue 

Video 2  (3:58)

Video 2  (3:58)

Nifty Access YouTube Thumb Nail
Play Video

… …

Form Values passed to Controls 

Form Values passed to Controls 

Video 3 (1:22)

Video 3  (1:22)

Nifty Access YouTube Thumb Nail
Play Video

… …

MORE - On the Form Load Issue 

The Form Load Issue  

Video 4 (2:00) Approx!

This video, from my YouTube Playlist:-

Object Oriented – Nifty Access

Explores creating a Class Module and how to use it with Allen Browne’s Calendar Form… However Allen Browne’s Calendar Form can be set up and used as is, you don’t need the Class Module, unless you want access to the advanced features the Class Module provides.

Follow the instructions on Allen Browne’s website – Popup Calendar HERE:-

http://allenbrowne.com/ser-51.html

I have created my own Calendar Control/Form, The:-

Nifty Date Picker

The NIFTY DATE PICKER has the distinct advantage that it’s very customisable. More Here:- 

Nifty Date Picker for ALL Versions of Access – Nifty Access

Colin’s Date Picker which in my opinion is very slick looking, (I’m jealous!) is HERE:-

A better Date Picker

Video 4 (2:00) Approx!

Nifty Access YouTube Thumb Nail
Play Video

… …

PopUp Form - Pass Data Back

PopUp Form - Pass Data Back

Video 4 (7:57)

In this video I demonstrate calling a pop-up form, extracting a row number from a subform in datasheet view on the form. I demonstrate how to extract text from the same subform. I suggest t’s a good idea to start using the “Value” of property. I explained how to pass the value by making a copy of the textbox. I passed that to the Pop-Up form. Then, add a custom property and pass the data into the custom property. I use the “With” – “End With” Block to bracket the code that operates on the form.

Video 4 (7:57)

Nifty Access YouTube Thumb Nail
Play Video

… …

Call Called Class

Call Called Class

Video 5 (9:44)

This was one of my early videos on “Call Calling” Class. As with most projects your code starts out with the goal of solving one particular problem. As you progress, you realise your idea can be applied more generally. I recently updated this Class Module . It was originally based on the Microsoft active X calendar control.

See YouTube playlist here:- Object Oriented – Nifty Access

Video 5 (9:44)

Nifty Access YouTube Thumb Nail
Play Video

… …

More Useful Stuff HERE:-

Leave a comment

This website uses third-party software - WordPress Add-Ins to be exact. I don't know what any individual add-in does, but I'm sure that many of them collect information about you. So be aware, if you continue using this site, then you are likely to be sharing your information. I don't know how to disable this sharing for any, or all of the plugins for individual users. So I can't stop the sharing of information. If this worries you then please do not use this site... If you continue to use this site I will assume that you are happy with it.

Do you need a hand in the right direction?

You are in the right place.