Hello:

I have done some VBA coding in the past, but this is my first experience using the DAO 3.6 Object Model. The HMI software I'm using for a distributed control system incorporates VBA. In my application, I have several Access databases that all contain one table with the same field names. I want to be able to query this single table in all of the databases looking for certain events and display these in a listbox control on a user form. What would be the syntax of the SQL query to include the records from multiple databases into a single record set? Here is some of my code (???????? is my issue, but maybe I am not even thinking about this correctly):

Dim ws_DL As Workspace
Dim db_Log1 As Database
Dim db_Log2 As Database
Dim db_Log3 As Database
Dim rs_Combined As Recordset
Dim sQuery As String
sQuery = "SELECT DateAndTime, Val FROM StringTable WHERE " & _
"(TagIndex = 1 AND Marker = 'S') ORDER by DateAndTime"
Set ws_DL = Workspaces(0)
Set db_Log1 = ws_DL.OpenDatabase("C:\ACCESS_Data\Log1.mdb")
Set db_Log2 = ws_DL.OpenDatabase("C:\ACCESS_Data\Log2.mdb")
Set db_Log3 = ws_DL.OpenDatabase("C:\ACCESS_Data\Log3.mdb")
Set rs_Combined = ????????.OpenRecordset(sQuery)



Then, I could loop through the recordset to the .EOF and create strings to populate the listbox. I know I can create a recordset for each database, but then I would have to merge them into some type of data structure, and sort them myself.
Can anyone help? Thanks -- David O.