you might try something like this
' this is used by the cell changed event to allow us to just change a
' single cell in a record, rather than full record updates. work in
' progress
Public Sub subDiscreteFieldUpdate(strTable As String, strIndex As String,
strGUID As String, strField As String, strValue As String)
Dim intResult As Integer
Dim str_db_filename As String
Dim db As Database
Dim visDocument As Visio.Document
Dim visPage As Visio.Page
Dim SaveErr As Long
Dim errDB As ADODB.Error
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim strProvider As String
Dim strSource As String
Dim strConn As String
Dim strSelect As String
strProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
strSource = "Data Source="
Dim strProviderED As String
strProviderED = ";"
On Error GoTo DiscreteField_Exit
'first we have to find out which database is associated with this
document
Set visDocument = Visio.ActiveDocument
Set visPage = visDocument.Pages.item("Project Definition")
str_db_filename = visDocument.Path &
visPage.PageSheet.Cells("prop.database_file.value").ResultStr("")
strConn = strProvider & strSource & str_db_filename & strProviderED
cnn.Open strConn
strSelect = "SELECT * FROM " & strTable & " Where " & strIndex & " =
" & strGUID
rst.Open strSelect, cnn, adOpenKeyset, adLockOptimistic
If (rst.BOF And rst.EOF) Then
' Debug.Print "err discrete field update " & strGUID & " record
not found"
GoTo DiscreteField_Exit
End If
' MsgBox strValue
If strField = "propcost" Then
' Debug.Print "propcost " & Int(strValue)
rst.Fields(strField).Value = Int(strValue)
Else
rst.Fields(strField).Value = strValue
End If
rst.Update
DiscreteField_Exit:
rst.Close
cnn.Close
DoEvents
Exit Sub
DiscreteField_Err:
SaveErr = Err.Number
If SaveErr <> 0 Then
Debug.Print "Err in subDiscreteFieldUpdate is " & Err & " " &
Err.Description
Debug.Print strGUID & " " & strField & " " & strValue
For Each errDB In cnn.Errors
Debug.Print "DB Update " & " " & strGUID & " " & strField & " "
& strValue
Debug.Print "DB Description: " & errDB.Description
Debug.Print "DB Number: " & errDB.Number & " (" & _
Hex$(errDB.Number) & ")"
Debug.Print "JetErr: " & errDB.SQLState
Next
' Resume DiscreteField_Exit:
End If
End Sub