How to use the value from another form.

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

Guest

Hi gusy, I have two forms: CategoryForm and CategoryResults, and there are
'opt1, opt2, and opt3' in CategoryForm, how can I use the opt1,2,3, in form
CategoryResults?

Thank you.
 
Vivian,
As long as both forms are open, you can refer to each field using...
=Forms!CategoryResults!Opt1
or
=Forms!CategoryResults!Opt2 '... etc

If there is a realtionship between CategoryForm and CategoryResults, you
might be able to include those fields in the query behind CategoryForm, so
they are "resident" to that form. But, at least, the solution above will
work.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
Hi Al,
Please forgive my poor knowledge of Access, I tried the way you gave, but it
didn't work,the CategoryResults is the query result of the CategoryForm, I
created the queries when category = Organizaiton/government/others, the
result is the CategoryResults form with a button 'Preview Report', I hope
each time after get the result of the query, when click the button, relevent
report will appear, that's why I need the value fromthe CategoryForm.I did as
below:

Select Case Form!CategoryResults!optChoose
' opt1
Case 1
stDocName = "Non-profitOrganization"
DoCmd.OpenReport stDocName, acPreview
'opt2
Case 2
stDocName = "Government"
DoCmd.OpenReport stDocName, acPreview
'opt3
Case 3
stDocName = "Others"
DoCmd.OpenReport stDocName, acPreview
Case Else
End Select

it doesn't work, could you help me figure it out? Thank you.
 
Vivian,
You wrote...
Select Case Form!CategoryResults!optChoose
That should be...
Select Case Forms!CategoryResults!optChoose (see the s on Forms)

And I assume that CategoryResults is still Open, and that optChoose is a
field on the main form.

I'm still a bit confused as to what your doing here, so if you still
have trouble, you may have to send me the .mdb file via my web site
"Contact" function. (no charge of course) Sometimes, with inexperienced
users, it's just as easy to fix the file than spend time going back and
forth with emails.
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
Back
Top