Joseph O'Connell
joconnell at indy.rr.com
Wed Oct 29 15:36:46 CST 2003
Paul, This is a function that I use in Access 2000 applications. Joe O'Connell joconnell at indy.rr.com '--------------------------------------------------------------------------- ---------- ' Write a query to the database '--------------------------------------------------------------------------- ---------- Function WriteQuery(strSQL As String, strName As String, strMsg As String) As Boolean Dim qdSQL As QueryDef WriteQuery = True On Error Resume Next CurrentDb.QueryDefs.Delete strName On Error GoTo WriteQuery_Err Set qdSQL = CurrentDb.CreateQueryDef(strName, strSQL) WriteQuery_Exit: Exit Function WriteQuery_Err: strMsg = Err.Description WriteQuery = False Resume WriteQuery_Exit End Function -----Original Message----- From: paul.hartland at fsmail.net <paul.hartland at fsmail.net> To: dba-vb <dba-vb at databaseadvisors.com> Cc: accessd <accessd at databaseadvisors.com> Date: Wednesday, October 29, 2003 8:20 AM Subject: [dba-VB] Saving a SQl query to an access database via Visual Basic 6 |To all, |I know I have done this before but for the life of me can't remember how, and can't find the code in any of my old projects. |I have a VB6 application that generates a SQL string, I need to save the SQL string as a query in my Access(XP) database |Can someone please tell me how to do this (even sample code if you can), before I pull whats left of my hair out. |Paul Hartland |Database Designer/Developer (so they say).......... |_______________________________________________ |dba-VB mailing list |dba-VB at databaseadvisors.com |http://databaseadvisors.com/mailman/listinfo/dba-vb |http://www.databaseadvisors.com |