O
OldEnough
I apologize if this is a foolish post. I have tried to figure it out but I
haven't had much luck. I would like to overwrite a local table by pulling a
new recordset from our backend. Users have a local app with a large table
that needs to be updated once every few days.
ideally I would drop the original table : Docmd.runsql "Drop Table tblItems;"
Then replace it with a new table.
The code below pulls the correct recordset. Could someone suggest how to
modify it to replace the original table
Dim strSQL As String
Dim oCmd As Command
Dim oRS As New ADODB.Recordset
Dim cnn As New ADODB.Connection
AppPath = getTA_dbPath() 'function to get backend db path
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0;Data Source=" & AppPath
End With
strSQL = "SELECT * FROM tblItems;"
Set oRS = New Recordset
With oRS
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
End With
Set oCmd = New Command
With oCmd
.CommandText = strSQL
.CommandType = adCmdText
.ActiveConnection = strConn()
Set oRS = .Execute
End With
oRS.Close
Set oRS = Nothing
Any suggestions would be appreciated.
haven't had much luck. I would like to overwrite a local table by pulling a
new recordset from our backend. Users have a local app with a large table
that needs to be updated once every few days.
ideally I would drop the original table : Docmd.runsql "Drop Table tblItems;"
Then replace it with a new table.
The code below pulls the correct recordset. Could someone suggest how to
modify it to replace the original table
Dim strSQL As String
Dim oCmd As Command
Dim oRS As New ADODB.Recordset
Dim cnn As New ADODB.Connection
AppPath = getTA_dbPath() 'function to get backend db path
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0;Data Source=" & AppPath
End With
strSQL = "SELECT * FROM tblItems;"
Set oRS = New Recordset
With oRS
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
End With
Set oCmd = New Command
With oCmd
.CommandText = strSQL
.CommandType = adCmdText
.ActiveConnection = strConn()
Set oRS = .Execute
End With
oRS.Close
Set oRS = Nothing
Any suggestions would be appreciated.