Advertisement
Guest User

Untitled

a guest
Mar 29th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. Public Sub LoadProperty()
  2. '**Finds the Current Property Data
  3.  
  4. 'Error Checking
  5. ' On Error GoTo Err_LoadProperty
  6. Try
  7.  
  8. Dim uRecSnap As ADODB.Recordset
  9.  
  10.  
  11. ' Check For Open Connection
  12. If uDBase Is Nothing Then
  13. OpenConnection()
  14. bConnection = True
  15. End If
  16.  
  17. ' Run Stored Procedure - Load Property Record
  18. uCommand = New ADODB.Command
  19. With uCommand
  20. .ActiveConnection = uDBase
  21. .CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
  22. .CommandTimeout = 0
  23. uCommand.Parameters.Append(uCommand.CreateParameter("@PropertyID", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamInput, , Val(lblPropertyIDValue.Text)))
  24. .CommandText = "PropertyMaster_LoadRecord"
  25.  
  26. uRecSnap = .Execute
  27. End With
  28.  
  29. ' Store Data Values
  30. Do Until uRecSnap.EOF
  31. lblPropertyIDValue.Text = If(IsDBNull(uRecSnap("PropertyID").Value), "", uRecSnap("PropertyID").Value)
  32. lblSPMReferenceValue.Text = If(IsDBNull(uRecSnap("SPMReference").Value), "", uRecSnap("SPMReference").Value)
  33. cmbPropertyManager.Text = If(IsDBNull(uRecSnap("PropertyManager").Value), "", uRecSnap("PropertyManager").Value)
  34. txtAddress1.Text = If(IsDBNull(uRecSnap("AddressLine1").Value), "", uRecSnap("AddressLine1").Value)
  35. txtAddress2.Text = If(IsDBNull(uRecSnap("AddressLine2").Value), "", uRecSnap("AddressLine2").Value)
  36. txtAddress3.Text = If(IsDBNull(uRecSnap("AddressLine3").Value), "", uRecSnap("AddressLine3").Value)
  37. txtTown.Text = If(IsDBNull(uRecSnap("Town").Value), "", uRecSnap("Town").Value)
  38. txtPostCode.Text = If(IsDBNull(uRecSnap("PostCode").Value), "", uRecSnap("PostCode").Value)
  39. chkAvailable.Checked = If(IsDBNull(uRecSnap("Availabilty").Value), "", uRecSnap("Availabilty").Value)
  40. dtpAvailable.Value = If(IsDBNull(uRecSnap("Available").Value), "1/1/1900", uRecSnap("Available").Value)
  41. chkFactored.Checked = If(IsDBNull(uRecSnap("Factored").Value), 0, uRecSnap("Factored").Value)
  42. txtFactorName.Text = If(IsDBNull(uRecSnap("FactorsName").Value), "", uRecSnap("FactorsName").Value)
  43. txtFactorsEmail.Text = If(IsDBNull(uRecSnap("FactorsEmail").Value), "", uRecSnap("FactorsEmail").Value)
  44. dtpPropertyBuilt.Value = If(IsDBNull(uRecSnap("PropertyBuilt").Value), "1/1/1900", uRecSnap("PropertyBuilt").Value)
  45. txtPropertyValue.Text = If(IsDBNull(uRecSnap("PropertyValue").Value), "", uRecSnap("PropertyValue").Value)
  46. txtMinimumFee.Text = If(IsDBNull(uRecSnap("MimimumFee").Value), "", uRecSnap("MimimumFee").Value)
  47. txtCostAuthorisationAmount.Text = If(IsDBNull(uRecSnap("CostSuthorisationAmount").Value), "", uRecSnap("CostSuthorisationAmount").Value)
  48. txtCommision.Text = If(IsDBNull(uRecSnap("Commission").Value), "", uRecSnap("Commission").Value)
  49. chkVacant.Checked = If(IsDBNull(uRecSnap("Vacant").Value), 0, uRecSnap("Vacant").Value)
  50. dtpVacant.Value = If(IsDBNull(uRecSnap("VacantDate").Value), "1/1/1900", uRecSnap("VacantDate").Value)
  51. txtStartingRent.Text = If(IsDBNull(uRecSnap("StartingRent").Value), "", uRecSnap("StartingRent").Value)
  52.  
  53. uRecSnap.MoveNext()
  54. Loop
  55.  
  56. ' Close Connection
  57. uRecSnap.Close()
  58. If bConnection Then CloseConnection()
  59. uRecSnap = Nothing
  60.  
  61.  
  62. Catch ex As Exception
  63. MsgBox(vbCrLf & ex.Message & vbCrLf & "Source---" & vbCrLf & ex.Source & vbCrLf & "Problem---" & vbCrLf & ex.StackTrace, MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "SouthSide- Error Reporting")
  64.  
  65. End Try
  66.  
  67.  
  68.  
  69. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement