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!

Get values from SQL query into a string (string manipulation)

Status
Not open for further replies.

amcodah

Programmer
Jul 9, 2003
80
0
0
NO
Hi, I need some help here.
I have a query which prints out some data IE:

ID
1
2

I need to put that data into a string, so it would look like this : "1, 2"

.. hence if there would be more data (id numbers) then it would go like this : "3, 6, 9, 14" for example.

Any ideas?
Thanks
 
In VBA, Dim a string variable. Then create a recordset based on your query. Iterate through the recordset and, for each reocrd, append the relevant value of the ID field to the string variable. Then append a ", ", then loop to the next record.
 
Yes, that's what I thought about doing aswell. But woudln't that me cpu/time-demanding operation? Isn't there a easier way to solve it?

Thanks for your quick feedback anyway ;)
~amcodah()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top