+ Reply to Thread
Results 1 to 3 of 3

Send Values Between Form Controls VBA

  1. #1
    Forum Contributor
    Join Date
    12-28-2015
    Location
    US
    MS-Off Ver
    365
    Posts
    133

    Send Values Between Form Controls VBA

    I am using the below code to transfer values between forms and it works well, however when I go to reference a form that has a "&" in the title (see #2) I receive "Compile Error Expected:="

    After some research I suspect it's the "&" which I rarely use special characters, but is there a way to make it work?


    1. Forms!tblNameInput!Text15 = Forms!tblNameOutput!SeeNote

    2 .Forms!tblName&CityInput!Text15 = Forms!tblNameOutput!SeeNote

    Thanks!

  2. #2
    Forum Contributor
    Join Date
    03-05-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    301

    Re: Send Values Between Form Controls VBA

    1. You can use square braces: [] - Forms![tblName&CityInput]!Text15

    And if that doesn't work at runtime, then try

    2. Forms("tblName&CityInput").Form.Controls("Text15").value

    Also consider renaming your forms so that your forms have this convention: frmMyForm rather than tblMyForm

    Cheers

  3. #3
    Forum Contributor
    Join Date
    12-28-2015
    Location
    US
    MS-Off Ver
    365
    Posts
    133

    Re: Send Values Between Form Controls VBA

    Thank you sooo much!

    it worked perfectly. Sorry for the delay response I was away from work.

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Form Controls / Active X controls to record and log information in a seperate sheet
    By marcbarnett in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2014, 05:00 AM
  2. Replies: 1
    Last Post: 05-01-2014, 05:15 PM
  3. Hiding / Revealing Form Controls 'CheckBoxes' based on Cell Values
    By Dubs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-20-2013, 02:53 PM
  4. Replies: 0
    Last Post: 12-13-2011, 05:13 PM
  5. Form controls vs. ActiveX controls
    By wmorrison49 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2008, 10:59 AM
  6. ActiveX Controls vs Form Controls
    By Alex in forum Excel General
    Replies: 1
    Last Post: 01-11-2006, 04:50 AM
  7. Form Controls; setting properties based on cell values
    By Glenn Ray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-17-2005, 12:06 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1