Hey, I get this error with this piece of code, and I'm not sure why. That would be a big help as I try to make my code a little older to read
Public Function SaveProperty() As Boolean
'** Save Current Personal Data Record
' Error Checking
On Error GoTo Err_SaveProperty
' Dimension Local Variables
Dim uRecSnap As ADODB.Recordset
Dim uPar As ADODB.Parameter
' Check For Open Connection
If uDBase Is Nothing Then
OpenConnection()
bConnection = True
End If
' Run Stored Procedure - Save Property Record
uCommand = New ADODB.Command
With uCommand
.ActiveConnection = uDBase
.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
.CommandTimeout = 0
.Parameters.Append.CreateParameter("@PropertyID", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput, 50, Val(lblPropertyIDValue.Text))
.Parameters.Append.CreateParameter("@PropertyManager", ADODB.DataTypeEnum.adLongVarChar, ADODB.ParameterDirectionEnum.adParamInput, 60, cmbPropertyManager.Text)
.Parameters.Append.CreateParameter("@AddressLine1", ADODB.DataTypeEnum.adLongVarChar, ADODB.ParameterDirectionEnum.adParamInput, 30, txtAddress1.Text)
.Parameters.Append.CreateParameter("@AddressLine2", ADODB.DataTypeEnum.adLongVarChar, ADODB.ParameterDirectionEnum.adParamInput, 30, txtAddress2.Text
'...ETC
.CommandText = "PropertyMaster_SaveRecord"
.Execute()
End With
' Close Connection
uRecSnap = Nothing
uCommand = Nothing
If bConnection Then CloseConnection()
SaveProperty = True
Err_SaveProperty:
If Err.Number <> 0 Then
sErrDescription = Err.Description
WriteAuditLogRecord("clsProperty", "SaveProperty", "Error", sErrDescription)
SaveProperty = False
End If
Final function
I cut the lines of code because of something like this
uPar = .CreateParameter("@LandlordID", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput)
.Parameters.Append(uPar)
.Parameters("@LandlordID").Value = Val(lblLandlordID.Text)
source
share