Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2009
    St. Louis, MO

    Unanswered: Syntax for Control Source

    I seem to be having a brain fart today. Please remind me what the syntax for setting the .ControlSource in code.

    Private Sub ResultsFrame_AfterUpdate()
        On Error GoTo ResultErr
        If IsNull(Me.txtAnsweredBy) Then
            Me.txtAnsweredBy.ControlSource = "AuditReview"."AnsweredBy" '( Does not work)
            Me.txtDocuments.ControlSource = Documents
            Me.txtReviewNumb.ControlSource = ReviewID
            Me.txtAnsweredBy.Value = Environ("UserName")
            Me.AnsweredDate.Value = Format(Now(), "mm/dd/yyyy HH:mm:ss")
            Me.txtReviewNumb.Value = KeyVal("ReviewNumb")
            ' Add the ReviewID to the table
             Me.txtReviewNumb.Value = KeyVal("ReviewNumb")
        End If
        Exit Sub
        'do nothing
    End Sub
    I don’t want to set the source until I am ready to use it.

  2. #2
    Join Date
    May 2005
    I believe you need to set the ControlSource property to a string, so something like:
            Me.txtAnsweredBy.ControlSource = "AuditReview.AnsweredBy"
            Me.txtDocuments.ControlSource = "Documents"
            Me.txtReviewNumb.ControlSource = "ReviewID"
    But then again, I don't know what these things are; are they queries? tables? variables? It makes a difference. Do a help search on the ControlSource property and you'll probably find the info you need.
    Me.Geek = True

  3. #3
    Join Date
    Jan 2009
    St. Louis, MO
    Want to set the value of a TextBox to a Table/Field

  4. #4
    Join Date
    Nov 2007
    Adelaide, South Australia
    You can only set the Control Source to that of a field in your form's Record Source, or to an expression. You might want to check out DLookup.

    Do it manually first -- go to the control source you want to set and set it. Once you have it working, you will know what to set it to with code.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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