Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm trying to pass values from one Access form to a textbox in another form. I'm sure someone has asked this before but I can't seem to find it.

    I'm using microsoft Access 2007 and using VB to pass the values. I want the text box in form1 to update as soon as I close or hide form2 but everytime i try to send the value i get a "object variable or with block not set" error message.

    I've declared frm2 as a global variable in a module but the following code in form2 keeps giving me the error.

    frm2.textbox = "hi"


    Thanks in advance!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try

    Forms!frmForm1!txtSomething = "hi"

    where frmForm1 is the name of the form and txtSomething the name of the text box.

    If one of the names contains spaces or punctuation, enclose the name in square brackets:

    Forms![Other Form]![Message Text] = "hi"

  3. #3
    New Lounger
    Join Date
    Jul 2008
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='784974' date='16-Jul-2009 19:19']Try

    Forms!frmForm1!txtSomething = "hi"

    where frmForm1 is the name of the form and txtSomething the name of the text box.

    If one of the names contains spaces or punctuation, enclose the name in square brackets:

    Forms![Other Form]![Message Text] = "hi"[/quote]



    That works!

    Thanks A LOT!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •