Storing SQL results via Recordset in a text box (1 Viewer)

andatabase

New member
Local time
Today, 14:35
Joined
Jul 23, 2015
Messages
14
Hello,
I am currently building a form where I need to store the results of an SQL into a text box.
The results will be a one field query, where it will display the Customer names. The bit I am stuck on is not the SQL, but to go through the results and assigning it to a textbox.
Will I need to do a for loop and assign to an array? If so, I will need some assistance with the coding. Thanks in advance!
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:35
Joined
May 21, 2018
Messages
8,554
Why not use a listbox? You can bind the recordset directly. If not you need to loop and create a concatenated string.
 

andatabase

New member
Local time
Today, 14:35
Joined
Jul 23, 2015
Messages
14
Listbox won't help as this needs to be for info only. This text box will display the customers for selected records:
"Selection includes: Customer A, Customer B"

Thanks for your suggestion, mind.

I will need some help on the for loop and concat string, if that is the case.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:35
Joined
May 21, 2018
Messages
8,554
I will need some help on the for loop and concat string, if that is the case
That referenced thread shows 2 generic functions or a way to roll your own as I prefer.
 

andatabase

New member
Local time
Today, 14:35
Joined
Jul 23, 2015
Messages
14
Woops! Sorry, just read the header. I will have a look.

thanks
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 09:35
Joined
May 21, 2018
Messages
8,554
If your main form is not Continuous then you can add a subform or subreport to show this. That is the easiest method. You can set the properties of the subform to be "read only" and a subreport is display only anyways. Only need to concatenate if in continuous view like the thread.
 

Isaac

Lifelong Learner
Local time
Today, 06:35
Joined
Mar 14, 2017
Messages
8,826
Maybe this should be moved to VBA forum, not Macros
 

Users who are viewing this thread

Top Bottom