Originally Posted by
June7
You need a table that the recordset is based on.
Well. That's unfortunate! I think I might be taking the wrong approach. Can you please confirm; I can't write directly to a recordset like the one I've defined in my original post? I was hoping to leverage the idea presented in this post
Originally Posted by
June7
(apparently values are separated by CrLf)
This is correct; the list of record IDs would be separated by CrLf. The user has built this list of record IDs by copying text from a PDF and manipulating it in word to eliminate all of the extraneous data (this is a process I have no control to change),
Since this is an intermediate process i.e. pasting the list into a textbox control I don't need or want these values in a table (except, perhaps, as a means to do a query). Really all I need to do is to get these record IDs into a query. Since I need to reformat them I thought that the easiest way to do that would be to get them into some sort of table-like structure (i.e. a recordset) and manipulate them from there and then use that recordset in a join in a query of table which has the records that I'm interested in retrieving (or alternatively as a subquery in the WHERE clause).
Originally Posted by
June7
You have to parse the user input of a string... I would parse the string to an array object then use looping code to save each array element to table.
I've never needed to do this. If you could point me to a resource which shows how to do this I would be ever so appreciative.
Perhaps the right solution is to bypass the whole recordset idea and simply parse the string (including reformatting the IDs as required) and build up the SLQ statement for my query. I had initially thought of this but then, because I didn't know how parse the string, thought that putting the records into a "virtual table" (that's what I thought a recordset was) would be the easier route. Apparently not...
The query would wind up looking something like this;
Code:
SELECT<Columns I want to return>
FROM [The table which has the data I need to get]
WHERE[Disposition_Id] IN (
'LOC 1768',
'LOC 4769',
'LOC 840127',
'LOC 840369',
'LOC 840757',
'LOC 841396',
'LOC 860794',
'LOC 870344',
'LOC 880796',
'LOC 942090',
'MSL 3454',
'MSL 3602',
'MSL 3794',
'MSL 4444',
'MSL 792262',
'MSL 831287',
'MSL 840203',
'MSL 841156'
)
OR
Code:
SELECT<Columns I want to return>
FROM [The table which has the data I need to get] T1
WHERET1.[Disposition_Id] IN (SELECT * FROM [The table I've built which contains the user-supplied IDs])
OR
Code:
SELECT<Columns I want to return>
FROM [The table which has the data I need to get] T1
JOIN [The table I've built which contains the user-supplied IDs] T2
ON T1.[Disposition_Id] = [T2.Disposition_Id]
Thanks again to all who have weighed in on this.
Finally; I'm still looking for an easy solution which will allow me to take a list of record IDs pasted into a text box and to build an SQL query statement.
Any assistance is very much appreciated.