Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

mysql query results in access

$
0
0
I've been shifting my Access database to use a mysql back end and have been trying to solve this problem:

I create my SQL queries based on input from the user, execute a SELECT query, and then display the results in a temporary query - but the results can't be sorted or the display of the data otherwise adjusted.

My latest approach was to create a "generic" query in Access whose records would be updated to the SQL results and then displayed, but I haven't had much success with that.

This is what I've been using (VBA) to execute the SQL statement and return the records in a temporary query (ContactSQL and ContactTitle are functions that generate the SQL statement and descriptive text of the query, respectively):

Dim dbs As Database
Dim rs As Recordset
Dim qdf As QueryDef

strSql = ContactSQL
strTitle = ContactTitle

Set dbs = CurrentDb()
Set rs = dbs.OpenRecordset(strSql, dbOpenDynaset)

With dbs
Set qdf = .CreateQueryDef(strTitle, strSql)
DoCmd.OpenQuery strTitle
.QueryDefs.Delete strTitle
End With
dbs.Close
qdf.Close

Any suggestions on how to best present the data in Access would be greatly appreciated - thanks in advance!

Viewing all articles
Browse latest Browse all 13329

Trending Articles