Results 1 to 4 of 4
  1. #1
    HomerTG is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    2

    Question Variables by reference.

    I've started this code but am stopped by my ignorance. I just don't know enough.



    Dim Mvar as String

    How do I get MVar from being an actual variable to being the address of a variable? I'm putting it through a For I to 10 Next loop. I want to place inside it "CP"+(i) (which is a report variable that really exists) and then access it by reference. How do I get MVar to be accessed for the address, not what's really inside it?

    HomerTG

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What do you mean by "CP"+(i) is a report variable?

    What are you doing within this loop? Show code.
    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
    HomerTG is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    2
    I have various report variables for CP( which means Child Present). I have CP1 through CP10. This is for 38 programs, which are NUA1 through NUA38. I want to access each of these variables. I used to do this in old Clipper or Dbase by inserting a & prior to the variable. So MVar (containing "CP1") is presented to the compiler as &MVar (which is the address of CP1). In a for...next I can blow through these 38 x 10 variables quickly. I just do not know how to make MVar, which contains "CP1" or "CP"+(i), an actual address rather than a variable.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    The only thing I can suggest is to populate an array with the CP values then loop through the array.
    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.

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

Similar Threads

  1. Table with variables
    By e51lrrp in forum Access
    Replies: 8
    Last Post: 11-14-2013, 02:34 PM
  2. VBA variables in SQL
    By compooper in forum Programming
    Replies: 3
    Last Post: 07-06-2011, 11:04 AM
  3. VBA in variables
    By smikkelsen in forum Access
    Replies: 3
    Last Post: 11-12-2010, 03:14 PM
  4. Variables in Forms
    By NewDeveloper in forum Forms
    Replies: 1
    Last Post: 06-20-2010, 08:04 AM
  5. sql in vb variables
    By emilylu3 in forum Programming
    Replies: 3
    Last Post: 03-04-2006, 01:26 PM

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