Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign a Select result to a Textbox instead of ListBox 1

Status
Not open for further replies.

AccDeveloper

Programmer
Jul 13, 2003
7
0
0
CA
Hi,

I have this code:

Me.List89.RowSource = "SELECT SUM(SumOfNotional) FROM Data WHERE (Grouping='Revenue' And Fund='C179') AND (CC='CC1') HAVING YearOfChange= [forms]![OMRevenueSubgroup2]![Combo17]"


How do I assing the same select value to a Textbox ?

Thanks
Vic
 
heya vic,
create a recordset
set your recordset equal to your select statement
me.textboxname = recordset

That should do it

Durible Outer Casing to Prevent Fall-Apart
 
Give this a try:
Dim db as DAO.database
Set db = CurrentDB
db.QueryDefs("qryYourQueryName").SQL = "SELECT SUM(SumOfNotional) FROM Data WHERE (Grouping='Revenue' And Fund='C179') AND (CC='CC1') HAVING YearOfChange = [forms]![OMRevenueSubgroup2]![Combo17]"
Me![TextControl] = DLookup("[SumOfNotional]", "qryYourQueryName")
db.close

This requires a saved query named whatever you want it to be. Replace this query name in the red code above.

Bob Scriver
Want the best answers? See FAQ181-2886
Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top