Then based on that result of the SQL, i want to populate a textbox
Your approach might be OK for one textbox but not for several. It makes no sense to do it that way. You create the query that returns the results you want (based on criteria if required). Your form uses that query for its recordsource and you bind (link) a control on the form for each field in the query. So 8 query fields, 8 controls. They don't all have to be textboxes. In fact, you can use a form wizard and get a basic form in seconds, using that query. I don't advocate that you leave the automated design the way it turns out, but that's another story.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.