Results 1 to 2 of 2

Thread: Text box

  1. #1
    Join Date
    Aug 2002

    Unanswered: Text box

    How can I give to text box value that is sql query in access using VB code?
    If I write:
    Text_box_name = "select max(number) from table;"
    then the text box shows me:
    select max(number) from table;
    instead on number.
    What I do wrong?
    If I use List box then the query works.

  2. #2
    Join Date
    Aug 2002
    Québec, Canada
    Try the code following:

        'Create a recordset object
        Dim rs As Recordset
        'Select value with the recordset
        Set rs = CurrentDb.OpenRecordset("SELECT COUNT(*) FROM Table2")
        'Put that value in the textbox
        Me.txtTest = rs.Fields(0).Value
        'detroy the recordset
        Set rs = Nothing
    JefB - hope it helps

Posting Permissions

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