
Insufficient base table information for updating or refreshing
Hi
I get "Insufficient base table information for updating or refreshing"
when trying to run ADORecordset.Update
So... The file opens ok. I copy from one recordset to another.
Source= SQL Server - results and structure are almost the same as
destination
Destination=DBF (FoxPro 2.x table) - there are a few fields more in this
table comparing with source, but using the for loop I solved the problem,
replacing 1-1 field and "" for the fields that are not common.
In the end I want to UPDATE the AddNew Record and the "Insufficient base
table information for updating or refreshing"
error is raised.... Just great.
PLEEEEEASE HELP!!!!
Below the function:
Dim rez, intCount, recaff As Integer
'SQL
Dim rs As New ADODB.Recordset
'DBF
Dim rstmp As ADODB.Recordset
Dim cn As ADODB.Connection
Dim strSQL As String
Dim arraPar(0) As Variant
Dim arraVal(0) As Variant
Dim fld
arraVal(0) = KeyDoc
rez = OpenStoredProc("usp_ContifGetFac", arraPar, arraVal, rs)
If rs.State <> 0 Then
Set cn = New ADODB.Connection
Set rstmp = New ADODB.Recordset
With cn
.Provider = "MSDASQL.1;"
.CursorLocation = adUseClient
.ConnectionString = "DSN=Visual FoxPro Tables;UID=;SourceDB=" &
Path &
"SOFTEH\Gest\1\DBF\;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=
Machine;Null=Yes;Deleted=No;"
.Open
End With
' Pozitii
rstmp.Open "FF_P", cn, adOpenKeyset, adLockOptimistic,
adCmdTableDirect
rstmp.AddNew
rs.MoveFirst
For fld = 0 To rs.Fields.Count - 1
rstmp.Fields(rs.Fields(fld).name).Value = rs.Fields(fld).Value
intCount = intCount + 1
Next
For fld = 0 To rstmp.Fields.Count - 1
If rstmp.Fields(fld).Value = "" Then
Debug.Print rstmp.Fields(fld).name
Select Case rstmp.Fields(fld).Type
Case adInteger
rstmp.Fields(fld).Value = 0
Case adDouble
rstmp.Fields(fld).Value = 0
Case adNumeric
rstmp.Fields(fld).Value = 0
Case adDBDate
rstmp.Fields(fld).Value = Now()
Case Else
rstmp.Fields(fld).Value = ""
End Select
End If
Next
'============================= ERROR ========================
rstmp.Update
rstmp.Close
' Antet
Set rstmp = Nothing
Set rs = rs.NextRecordset
Set rstmp = New ADODB.Recordset
rstmp.Open "FF_A", cn, adOpenDynamic, adLockOptimistic,
adCmdTableDirect
rstmp.AddNew
rs.MoveFirst
For fld = 0 To rs.Fields.Count - 1
rstmp.Fields(rs.Fields(fld).name).Value = rs.Fields(fld).Value
intCount = intCount + 1
Next
Set rstmp = Nothing
rstmp.Update
rs.Close
rstmp.Close
Set cn = Nothing