Saturday, August 13, 2011

Using recordset to return query of joined linked tables in MS Access using VBA?

Basically what I have is an MS Access database that have linked tables from a Master MS Access database. I am using VBA code to populated a listbox depending on what the user selects. The query that I use to return the records contains 4 joins on the linked tables. For some odd reason when i do rst.open sql, conn; it returns 0 records and the listbox is empty. But I did a debug.print sql to check if the query I wrote is wrong and I did ran a query using the QUERIES option in MS Access and indeed it was a working query with records. So then i check if the connection string was wrong. I changed the complex query to a simple select all query from 1 table. And all of a sudden that query works and the listbox got populated. How wierd is that. It returns record for queries with no joins in it and doesn't for queries with joins in them. How do i fix this weird error?

No comments:

Post a Comment