Results 1 to 3 of 3
  1. #1
    accessnewb is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York, NY
    Posts
    116

    Talking Need to understand code

    This may be a silly question but, I found this code online and used it on my form and it works!. This is the code (used as a macro):



    SetTempVar
    Name ActiveControlValue
    Expression = [Screen].[ActiveControl]


    SearchForRecord
    Object Type
    Object Name
    Record First
    where condition =="[lngID]=" & [TempVars]![ActiveControlValue]

    So basically what happens is I have this combo box and there is a textbox below it. If I click on some other value in the combo box, then the textbox value automatically changes.

    Now I am curious as to how the code works. Could someone explain?

    Thanks!

  2. #2
    Dalagrath is offline Only a Man
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2010
    Location
    Colorado
    Posts
    45
    I am aware that the ActiveControl part is focusing on the Active box/field you are in.

    "Screen.ActiveControl Property (Access)." MSDN Explore Desktop, Web, Cloud, and Phone Software Development. Web. 03 Aug. 2011. <http://msdn.microsoft.com/en-us/library/ff844755.aspx>.
    Last edited by Dalagrath; 08-03-2011 at 09:48 AM. Reason: Hyperlink

  3. #3
    accessnewb is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York, NY
    Posts
    116
    umm..and what does this line do?

    where condition =="[lngID]=" & [TempVars]![ActiveControlValue]

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

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2011, 05:34 AM
  2. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  3. SQL - How to make Access understand time-span?
    By Jimmy_XistenZ in forum Queries
    Replies: 4
    Last Post: 10-12-2010, 12:21 PM
  4. Need To Understand MS Access Across A Network
    By johnmagu in forum Access
    Replies: 8
    Last Post: 05-25-2010, 03:14 PM
  5. Help me to understand forms
    By RTaylor in forum Forms
    Replies: 0
    Last Post: 04-10-2010, 01:36 AM

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