Passing a string from a form's TextBox to a report's TextBox

  • Thread starter Thread starter John S. Ford, MD
  • Start date Start date
J

John S. Ford, MD

I'm using Access 2000 and I understand that the OpenReport method doesn't
support the OpenArgs property.

I've read about a possible work-around this by storing a string in an
"invisible" TextBox on the calling form and having the report "extract" this
string for its own use.

My question is, how does a report refer to a control located on the form
that called it? Any help very much appreciated!

John
 
In the appropriate event (probably Open or Load)

Dim MyData as String

MyData = Forms!frmMyCallingForm!txtMyInvisText

where, as you have probably guessed, frmMyCallingForm will be the name of
the Form from which you call the Report, and txtMyInvisText will be the name
of the invisible text box (it doesn't _have_ to be invisible, BTW). Forms
refers to Access' FormsCollection (the collection of Open forms), so you
can't close that Form before the Report runs, but you do need to make sure
it is not popup, modal, etc., or you will cover up part of the Report
on-screen.

Larry Linson
Microsoft Office Access MVP
 
Back
Top