acDialog problem

whatdoidonext

New member
Local time
Today, 22:08
Joined
Jul 5, 2005
Messages
8
Hi

This may well have a simple answer but it eludes me as to what it is.

I have one form open from which a second one is shown to the user. This second form is set up with pop up and model set to yes and is opened in code as

DoCmd.openForm "frm_swap_results",,,,,acDialog

I need to populate this second form
e.g. Forms!frm_swap_results![WID1]=[dwdA]

In the above [dwdA] is a static variable defined in the first form and [WID1] is an unbound variable on the second form.

Unfortunately I keep getting the error message that access can't find the form frm_swap_results even though it is open on screen.

I would appreciate some guidance as to what I am doing wrong. helpAppreciate
 
Have you tried: Me.WID1 = Forms.frm_swap_results.dwdA
 
Rural Guy - thanks for the tip, unfortunately that did not work. When I type in Me in the code for form 1 the drop down does not show the variable WID1 on form 2. It appears that although form 2 is active, the code in the first form cannot see it.
 
Hi whatdoidonext,

I think I may not be understanding which form is trying to get what. In my mind form1 has launched Form2 with:

DoCmd.openForm "frm_swap_results",,,,,acDialog

acDialog will stop form1 code from running so form2 will have to either get data from form1 or put some there.

I need to populate this second form
e.g. Forms!frm_swap_results![WID1]=[dwdA]

In the above [dwdA] is a static variable defined in the first form and [WID1] is an unbound variable on the second form.

The above indicates to me that from form2 you need to get the [dwda] data from form1 so the code I supplied should be in form2 not form1.

If dwda really is a variable then it needs to be a public variable for it to be visible from another form. Controls can be bound but I don't know what an unbound variable is. All "variables" are unbound.

Sorry, but I could use a little clarification to offer additional assistance.
 
RuralGuy

Sorry to have confused you.
Form1 does launch Form 2 with DoCmd.openForm "frm_swap_results",,,,,acDialog

The static variable dwdA is defined in the code behind Form 1. It is not actually on form 1, it just takes a value from a control in form1 (I won't bore you with why).
With Form2 open I want to populate its field with the value of the static variable dwda.
What I need to know is can this be done from within the code of Form1 as I have tried with Forms!frm_swap_results![WID1]=[dwdA]
where frm_swap_results is the name of Form 2 OR should I code it as Me.WID1=dwdA on Form2

I have changed dwdA from being a static variable defined behind Form1 to a Public one in Module1 and used the code Me.[WID1]=dwda with the On load event of Form2 but it does not give it any value.
I hope this has helped as it is confusing me further!!
 
If I understand your situation correctly we can approach it two different ways. All of the information needed by form2 can be passed to form2 in the OpenArgs; or you can have form2 pick it off of form1. By the way you can declare Public variables in form modules. There is no need to put them in a general module. It is just that the form *must* be open to retrieve the data.

Why do you keep using [brackets]? Be careful with the use of the bang "!".
 
Thanks for the reply, apologies I could not post this earlier. I have made the changes but still cannot get this to work. I will go back to the drawing board and will post again if stuck. Many thanks.
 

Users who are viewing this thread

Back
Top Bottom