G
Guest
In a Project connected to (local) Anonymous Merge Subscription, cannot Add a
New Record programmatically. Works fine from Table View and Standalone Form
created with Wizard. CommandButton Event Procedure is a Cut-and-Paste Code
that works several other places in the ADP. In this Form it Errors out at
"rst2.Update"
Run-time error '-2147217873...':
Cannot insert the value NULL into column 'rowguid', table
Dim cmd2 As ADODB.Command
Set cmd2 = New ADODB.Command
cmd2.ActiveConnection = CurrentProject.Connection
cmd2.CommandType = adCmdText
cmd2.CommandText = "SELECT * FROM tblTeamContact WHERE 1=0"
Dim rst2 As ADODB.Recordset
Set rst2 = New ADODB.Recordset
rst2.CursorLocation = adUseClient
rst2.Open cmd2, , adOpenStatic, adLockOptimistic
Dim lngNID As Long
Randomize
lngNID = Int((Rnd * 2 ^ 29) - 2 ^ 28) * 10 + Val(Right$(pstrMachineName,
2))
rst2.AddNew
rst2![SchedID] = rst1!SchedID
rst2![PID] = rst1!PID
rst2![MDID] = rst1!PhysID
rst2![NFID] = rst1!NursingFacility
rst2![SysDate] = Now()
rst2![NoteDate] = Now()
rst2![ProvID] = pstrLogonID
rst2![NID] = lngNID
rst2.Update
rst2.Close
Set rst2 = Nothing
New Record programmatically. Works fine from Table View and Standalone Form
created with Wizard. CommandButton Event Procedure is a Cut-and-Paste Code
that works several other places in the ADP. In this Form it Errors out at
"rst2.Update"
Run-time error '-2147217873...':
Cannot insert the value NULL into column 'rowguid', table
Dim cmd2 As ADODB.Command
Set cmd2 = New ADODB.Command
cmd2.ActiveConnection = CurrentProject.Connection
cmd2.CommandType = adCmdText
cmd2.CommandText = "SELECT * FROM tblTeamContact WHERE 1=0"
Dim rst2 As ADODB.Recordset
Set rst2 = New ADODB.Recordset
rst2.CursorLocation = adUseClient
rst2.Open cmd2, , adOpenStatic, adLockOptimistic
Dim lngNID As Long
Randomize
lngNID = Int((Rnd * 2 ^ 29) - 2 ^ 28) * 10 + Val(Right$(pstrMachineName,
2))
rst2.AddNew
rst2![SchedID] = rst1!SchedID
rst2![PID] = rst1!PID
rst2![MDID] = rst1!PhysID
rst2![NFID] = rst1!NursingFacility
rst2![SysDate] = Now()
rst2![NoteDate] = Now()
rst2![ProvID] = pstrLogonID
rst2![NID] = lngNID
rst2.Update
rst2.Close
Set rst2 = Nothing