I have a table that is in SDE, what I want to do is in my userform click on the "Save" button, and the table will be edited even though it is not within the map document. Is this possible? I have tried the following code, which runs, but nothing happens to the table (I have also added the table to the map document and still nothing happens or no error messages occur). Here is that I have code.
Private Sub cmdSaveDev_Click()
Dim pTable As ITable
Dim pCursor As ICursor
Dim pRow As IRow
Dim pRowBuffer As IRowBuffer
Dim pPropset As IPropertySet
Set pPropset = New PropertySet
With pPropset
.SetProperty "Server", "***"
.SetProperty "Instance", "***"
.SetProperty "User", "***"
.SetProperty "Password", "***"
.SetProperty "Version", "SDE.DEFAULT"
End With
Dim pSdeWS As IWorkspace
Dim pSdeWF As IWorkspaceFactory
Set pSdeWF = New SdeWorkspaceFactory
Dim pSdeFeatWS As IFeatureWorkspace
Set pSdeFeatWS = pSdeWF.Open(pPropset, 0)
Set pSdeWS = pSdeFeatWS
Dim pWkspEdit As IWorkspaceEdit
Set pWkspEdit = pSdeFeatWS
Set pTable = pSdeFeatWS.OpenTable("SY_CSY_TERRIER.DEVELOPMENT_DEVELOPER")
Dim i As Integer
If lstSelectedDevelopers.ListCount = 0 Then
MsgBox "Add a developer to the Selected Developer box and try again"
Else
pWkspEdit.StartEditing (True)
pWkspEdit.StartEditOperation
Set pRowBuffer = pTable.CreateRowBuffer
Set pCursor = pTable.Insert(True)
For i = 0 To lstSelectedDevelopers.ListCount - 1
Set pRow = pRowBuffer
pRow.value(1) = frmCityDev.txtRecordNo
pRow.value(2) = lstSelectedDevelopers.List(i)
pCursor.Flush
Next i
pWkspEdit.StopEditing (True)
pWkspEdit.StopEditOperation
End Sub
Thanks!