Results 1 to 2 of 2

Thread: SQL Query result into a textbox??

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    1

    SQL Query result into a textbox??

    I am using an SQL query I designed in Access 97 to call uppon the string "AppName", which it uses to search the database, then it returns with a total. Here is the code I am currently using:

    Private Sub cmdLicence_Click()
    Dim AppName As String

    AppName = _
    InputBox("Which Application title would you like to sum licences for?")
    'Get name from user, via InputBox

    datSum.RecordSource = "select * from Southwing " & _
    "where Apps = '" & AppName & "'"
    'Merge that name with an SQL string


    Is there a way to convert this code to place the results of the query in that txtbox? Or maybe an easier way to do it without using a Data Control?

  2. #2
    Hyperactive Member beasty1711's Avatar
    Join Date
    Mar 2001
    Posts
    418
    to be able to put the data into a text box, you would need to assign it data to a recordset and then enter this data into and array or directly to the text box.

    dim MyRecords as ADODB.Rocordset
    dim strArrayData as string


    set MyRecords = New adodb.recordset should do it

    redim MyArray(MyRecords.RecordCount)

    for iStep = 1 to MyRecords.RecordCount
    strAarryData(istep-1)=MyRecords(0)
    MyRecords.MoveNext
    Next iStep

    that should do it
    "...They even have the internet on computers..." :- Homer Simpson

    "Second Place is First Looser" :- No Fear

Posting Permissions

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



Click Here to Expand Forum to Full Width