Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing a Textbox's Value from Another Form

Status
Not open for further replies.

yu217171

Programmer
Joined
Aug 2, 2002
Messages
203
Location
CA
Hi everyone,

I'm trying to access Form1.TextBox1.Text from Form2. Someone suggested I try

msgbox Forms ("Form1").TextBox1

But I get

Runtime Error: 2465: Application-defined or object-defined error.

Can anyone help? Why can't I just do Form1.TextBox1.Text?!?

Keith
 
Try...

Forms!Form1!TextBox1.text

or

Forms!Form1!TextBox1.value

Make sure Form1 is open in the background when doing this.
 
Does this work the same way with checkboxes? I am trying to set a checkbox on my form from my global VBA module and I'm getting Application-defined or object-defined error

My code is:
Code:
Forms!frmTesetReport.chkScanned.Value = True

What am I doing wrong?
 
Hi,

I get The OpenForm action was canceled. I am trying to display the value

Code:
'In Form1
Private Sub btnSubmit_Click ()
   if not isNull (me![txtMediaID]) then
      DoCmd.OpenForm ("Form2") '<-- Error on this line
   else
      MsgBox ("Please select a media type")
   end if
End Sub

'In Form2
Code:
Private Sub Form_Load
   MsgBox "MediaID: " & Forms!frmMediaTracker!txtMediaDesc.Value
End Sub


Just for context ...

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top