Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2002

    Unanswered: Viewing SQL-Generated Data in a Label


    I'm wondering if anyone would know how to get data to show up in a label caption based on SQL statements that are stored in String values. For example, I have a label name testLabel and I'm using the following SQL statement to pull information from a table and input it into the label:

    Private Const strSQL1 = "SELECT Field1 FROM Table1 WHERE Column = 'Testing Testing'"

    Is there any way to get the Value of that String to appear in a Label somehow?

    This is what I tried:
    Me!testLabel.Caption = strSQL1

    And I also tried:
    Me!testLabel.Value = strSQL1

    I've tried to assign that statement to the caption and value properties, but that only puts the literal "SELECT Field1 FROM Table1 WHERE Column = 'Testing Testing'" result of the String--not the value itself. I never get the value to show up in the label, only the SELECT statement. This is my second attempt at this because the first time I tried using a List Box and got the data there, but there was another problem with that I ran into. Let me know if you have any ideas at all. I'm using Access 97 too. Thanks much!


  2. #2
    Join Date
    Aug 2002
    Northampton, England
    Not sure why you would want to put the result in a label? Can you not put the results in the control source of a text box?

  3. #3
    Join Date
    Jul 2002
    I wasn't sure what the best way to do this was. If that would be a good way to do it, or simply a better way, could you explain how I would do that? I'd appreciate it!

Posting Permissions

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