Results 1 to 2 of 2
  1. #1
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123

    Change a Control Source of a textbox VBA

    In the Following Code I am wanting to change the control source to the DLookup
    my problem is because in the code the 'WkEnd', 'qryQtyNeed' need to be in double quotes.
    but it wont let me code double quotes within double quotes.
    how can I get this to work?



    Is there a way to use a query as the controlsource without the dlookup?

    Code:
    Dim WkEnd As String
    Dim WkDay As String
    WkEnd = "=DLookup('WkEnd', 'qryQtyNeed')"
    WkDay = "=DLookup('WkDay', 'qryQtyNeed')"
    Me.listEmp.Requery
    If Me.txtDayNo >= 6 Then
    Me.txtneeded.ControlSource = WkEnd
    Else
    Me.txtneeded.ControlSource = WkDay
    End If

  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,926
    Try:

    "=DLookup(""WkEnd"", ""qryQtyNeed"")"
    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. Replies: 12
    Last Post: 12-10-2013, 08:57 PM
  2. Textbox Control Source As Field Input
    By Jester0001 in forum Forms
    Replies: 4
    Last Post: 03-02-2012, 10:50 AM
  3. Replies: 17
    Last Post: 02-08-2012, 10:06 AM
  4. Copying entry form, change control source
    By Bdowns in forum Access
    Replies: 11
    Last Post: 02-06-2012, 05:39 PM
  5. Textbox Control Source As An Expression help!
    By emilyrogers in forum Forms
    Replies: 11
    Last Post: 02-11-2011, 07:31 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