Results 1 to 4 of 4
  1. #1
    Jerry Call is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    Champaign, Illinois
    Posts
    85

    Referencing form name and control in a procedure

    I've sent you a copy of my database, but don't bother looking at it, because nothing
    I'm bringing up here is in it on your end.

    I need to reference the value in a textbox on a form in a procedure, and I can't seem


    to get some of the syntax right. Let's say the form is frmSodaTallyS. Here's the
    relevant parts of its AfterUpdate event.

    [code]
    Dim TargetForm As Form
    Dim CollectUndo As Control
    Set TargetForm = Screen.ActiveForm
    [Code]

    Screen.ActiveForm correctly returns "frmSodaTallyS." But I can't get its name into
    TargetForm.

    I want to end up with--

    [Whatever returns frmSodaTallyS].Controls.CollectUndo.Value

    CollectUndo is a Long because it's a number, so I assume Value is the right word.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    try

    dim myLong as long
    myLong=Screen.ActiveForm.CollectUndo

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,957
    Code is in form AfterUpdate event? Why use object variables and not simply: Me.CollectUndo

    Value is default property for data controls so is not necessary to reference it.
    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.

  4. #4
    Jerry Call is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    May 2020
    Location
    Champaign, Illinois
    Posts
    85
    Thank you! I believe I've now got everything working, so close out this one.

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

Similar Threads

  1. Replies: 13
    Last Post: 05-12-2018, 05:03 PM
  2. Replies: 6
    Last Post: 02-23-2014, 05:53 PM
  3. Replies: 3
    Last Post: 02-15-2013, 03:36 PM
  4. referencing a control
    By looloo in forum Programming
    Replies: 3
    Last Post: 09-23-2011, 07:57 PM
  5. Replies: 0
    Last Post: 12-08-2009, 01:19 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