Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2006
    Posts
    126

    Unanswered: TextBox Source from Select

    In a report, there is a text box that is to be populated with a person's name.
    The name comes from a table other than the one that's the report's source. The table is a list of committee members with their title (unique), name, address, etc as fields. There is only one person with each title.

    I tried to set the text box source to "SELECT [Name] FROM [qCommittee] WHERE [qCommittee]![Title]="President". This gives a error. I suspect that the reason for the error is any SELECT really gives a list of [Name]s that qualify (even though there is only one), not a single name.
    What is the correct function or proceedure to use to populate the text box with the name from the table?

    Pete Townsend
    PGT

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    You can use DLookup or actually create/open a recordset based on your select statement and grab the value of a field in a record to populate the text box.

  3. #3
    Join Date
    Aug 2006
    Posts
    126
    Thanx Rogue,
    Boy was I dense. I've used DLOOKUP many times and for some reason it went bye-bye in the brain. Worked just as advertised. I did have a problem for a few minutes because my criteria was a string match; using single quotes inside the double quotes required around "criteria" solved that problem.
    Pete
    PGT

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    As you've found out you cannot use SELECT Queries to populate textboxes in forms/reports. The general rule is that only Action Queries are allowed in VBA.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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