Need Urgent Help!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am calling another form from the 1st form using
command button, I have a need to pass value of variables
How can I do this?

I already tried suggestions of using public
variable and Form!firstfom.ControlName
but it didin't work form me.

I need help!!!

Thank you in advance!
-Me
 
Your description is not giving us enough information. Variable in VBA? Using
the variable value to filter the form? To display on the second form? How
are you opening the form? Please provide more details.
 
Ken,

I have created a command button and on <buttonname>_Click event, I am
issuing -

DoCmd.OpenForm stDocName, , , stLinkCriteria
where stDocName = my 1st form name
stLinkCriteria = where condition,

It works just fine, it brings up the 2nd form and displays
corresponding records.

But I have a need to use the value of field that I am passing
into my 2nd form.

I tried using VB public varible in 1st form and I am passing
the value in first form, but for some reason, I am unable
to use this value anywhere in my 2nd form. But as I told
in the query it fetches correct records. The problem occurs
when the corresponding record isn't there in 2nd form.

I hope this helps.

How can I achieve this?

Thank you,
-Me
 
Hi,
Where did you declare this 'public' variable?
It needs to be declared in a standard module, not in Form1.
Is that the problem?

On the other hand, if you just need to pass a value to form2 when it opens,
use the OpenArgs argument of OpenForm.
 
Dan,

I used OpenArg and it works now, I had given additional
comma for DoCmd.Openform

Thanks a lot for all your help!
-Me
 
Back
Top