Is this type of RecordSet possible?

Mark McCumber 431 Reputation points
2023-04-14T14:45:50.5366667+00:00

Hi Everyone, I don’t know if this is possible. I wish to create a virtual Table/RecordSet, open it and add data into it as a standard ADO RecordSet. After the RecordSet is populated I want to be able to pass the RecordSet’s data to a different form. I have seen an example on how to create Virtual RecordSets, but the OpenRecordSet Method requires either a table or query before the recordset can be used. Any help will be appreciated. Thanks, MRM256

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
834 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. VasimTamboli 4,420 Reputation points
    2023-04-14T20:40:53.87+00:00

    Yes, it is possible to create a virtual table/recordset in ADO and populate it with data. You can create a disconnected recordset using the ADO Recordset object's CreateObject method, and then populate it with data by adding records and fields manually. Here is some sample code that demonstrates this:

    mathematica Copy code Dim rs As ADODB.Recordset Set rs = CreateObject("ADODB.Recordset") rs.CursorLocation = adUseClient rs.Fields.Append "Field1", adVarChar, 50 rs.Fields.Append "Field2", adVarChar, 50 rs.Open

    rs.AddNew rs.Fields("Field1").Value = "Value 1" rs.Fields("Field2").Value = "Value 2" rs.Update

    'Pass the RecordSet to a different form' Set otherForm.rs = rs In this example, we create a recordset with two fields, open it, add a new record, and populate it with data. You can then pass this recordset to a different form by assigning it to a variable on that form.

    3 people found this answer helpful.

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Mark McCumber 431 Reputation points
    2023-04-15T19:58:22.3266667+00:00

    TO everyone who replied to my question. Since I spread my subroutines and functions throughout the application in different modules. Each reply fixed a separate part of the application. The supplied answers helped with the RecordSet part. However, another issue has popped up regarding showing the RecordSet results in the Combobox. This will be posted as a separate question. Thank you, MRM256

    0 comments No comments