I have inherited a database that I am converting to a SQL Server 2005 backend from the JET database. The previous programmer created a function for action queries that he passes a sql string into and then uses the db.execute method.
Unfortunately, it doesn't seem to work with linked SQL Server tables for some reason. Any idea why it won't work? Or should I just replace the GetDB.Execute sql, plOptions with:
I don't get the plOptions that the .execute method allows, but I've searched the whole database and the previous programmer doesn't actually ever pass any options in through the function anyway, so I don't think I'm missing anything.
Any cautions about my replacement code?
Code:
Function RunSql(sql As String, Optional plOptions As Long) As Boolean
On error goto ErrRoutine
Screen.Mousepointer = 11
GetDB.Execute sql, plOptions 'GetDB is a function to get current database
RunSql = True
etc.
Unfortunately, it doesn't seem to work with linked SQL Server tables for some reason. Any idea why it won't work? Or should I just replace the GetDB.Execute sql, plOptions with:
Code:
Docmd.SetWarnings False
Docmd.RunSQL(sql)
Docmd.SetWarnings True
I don't get the plOptions that the .execute method allows, but I've searched the whole database and the previous programmer doesn't actually ever pass any options in through the function anyway, so I don't think I'm missing anything.
Any cautions about my replacement code?