A family of Microsoft relational database management systems designed for ease of use.
I created a function fncADO_Execute to replace the CurrentDB function. I pass it the SQL string that CurrentDB would have used. It works most of the time. Although there are a few queries that won't work using the ADO version. So, I have an On Error section that flips it back to the CurrentDB if it fails. And that also works.
I've also had some issues where executing an actual Query creates some bogus issue, including trying to tell me that my database is unknown. So, I put the SQL code into the strSql variable and call the fncADO_Execute function instead.
Public Function fncADO_Execute(strSql as String) As Boolean
Dim bolOK As Boolean
Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim prm As New ADODB.Parameter
Dim g_Connection As String
g_Connection = CurrentProject.Connection
Set cn = New ADODB.Connection
cn.Open g_Connection
'***** Fix Error - 3048 *****
Set cmd = New ADODB.Command
On Error GoTo ErrorHandler
With cmd
.ActiveConnection = cn
.CommandText = strSql
.CommandType = adCmdText
End With
cmd.Execute
cn.Close
Set cmd = Nothing
Set cn = Nothing
bolOK = True
GoTo Done
ErrorHandler:
CurrentDb.Execute strSql
Debug.Print
bolOK = True
Done:
fncADO_Execute = bolOK
End Function