Displaying result of SQL query in a text box 
Author Message
 Displaying result of SQL query in a text box

Does anybody know how to display the result of an SQL query in a text box?

For example -
****************************************************************************
*******
SQLSum = "select sum(totals) from TicketsBooked where CustomerCode =
" +  Str$(vCustomerCode) + ""

Data1.RecordSource = SQLSum
Data1.Refresh
****************************************************************************
********
I want to display the result of the sum function in a text box on a form.

Thanks in advance.

Brant



Sat, 11 Nov 2000 03:00:00 GMT  
 Displaying result of SQL query in a text box

    Dim dbs As Database
    Dim rst As Recordset

    Set dbs = OpenDatabase(App.Path & "\YourDB"")
    Set rst = dbs.OpenRecordset("select sum(totals) from TicketsBooked where
CustomerCode=" _
                                & "'Str$(vCustomerCode)'")

    Text1 = rst(0)
--------------------------------------------------------------------------------

Note that you need to change your double quotes to single quotes
around variable ----

You may try

        text1=data.recordsource(0)

It may work --

Regards, Davie.

Quote:

> Does anybody know how to display the result of an SQL query in a text box?

> For example -
> ****************************************************************************
> *******
> SQLSum = "select sum(totals) from TicketsBooked where CustomerCode =
> " +  Str$(vCustomerCode) + ""

> Data1.RecordSource = SQLSum
> Data1.Refresh
> ****************************************************************************
> ********
> I want to display the result of the sum function in a text box on a form.

> Thanks in advance.

> Brant



Sun, 12 Nov 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. SQL query result display (text box)

2. Trying to Display the result of an SQL Query into a textbox

3. Populating a text box with the results of a select query

4. How do I retrieve aggregate SQL result and put into text box

5. Display in a text box a query

6. SQL queries on sql results

7. Text Box Entry To Text Box Display?

8. Dialog box displayed during query insert or query update

9. Displaying CorssTab Query results in combination with VBA code

10. display ad hoc query results

11. Displaying message to user with query result number

12. How to Display Results of Indexing Services Query?

 

 
Powered by phpBB® Forum Software