Results 1 to 7 of 7
  1. #1
    Nod_Swerdna is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    27

    Manipulating Control Names ...


    Does anyone know if there is a way to use a string concatenation to refer to a control name. eg. Referring to Control1, Control2, Control3, Control4, etc using something like Me.["Control" & "1"], Me.["Control" & "2"], etc

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    For n = 1 to 4
    Me("Control" & n)
    Next
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Nod_Swerdna is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    27
    Tried your suggestion. The compiler had a problem with Me("Control" & n).

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    It works for me. Don't know why it doesn't for you. Post your entire relevant code. Are your controls actually named Control1, Control2, etc?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Nod_Swerdna is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    27
    I tried this

    for n = 1 to 4
    me(n & "QTY") = n ' Just load the variable with the value of n for now to see if code works
    next n

    The compiler immediately changed me(n & "QTY") to Me (n & "QTY") and threw an error when I tried to run it.

  6. #6
    Nod_Swerdna is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    27
    My controls are actually named Me.[1QTY], Me.[2QTY], Me.[3QTY] .. Me.[19QTY]

  7. #7
    Nod_Swerdna is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2015
    Posts
    27
    IT WORKS NOW!!!
    I retyped the code as you had it and tried it again. I don't know what happened the first time.
    Thank you SOOOO Much !!!!
    Don.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 02-28-2015, 01:23 PM
  2. Replies: 3
    Last Post: 01-24-2014, 03:33 PM
  3. Manipulating list from an other form
    By alka in forum Access
    Replies: 9
    Last Post: 11-19-2013, 09:52 AM
  4. manipulating a queries
    By kfc in forum Access
    Replies: 1
    Last Post: 10-19-2012, 08:41 PM
  5. writing control names on a form to a table
    By focosi in forum Access
    Replies: 1
    Last Post: 09-21-2011, 08:47 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums