AndrewDotto
Registered User.
- Local time
- Today, 17:38
- Joined
- Nov 24, 2011
- Messages
- 14
Hi Guys,
I'm trying to adapt some code an ex-employee has written to perform a different function, not really too crash hot with the finer points of VBA unfortunatly. Anyone have any ideas?
Notes:
xxxxxxx_WM_PROPERTY is a linked table in the database.
[forms]![xxx]![propertyref] is a number field in the form.
I get a type mismatch error at the line strSQL... is it because i am trying to pass the form field into the string? Is there another way of doing this?
Thanks for your help,
Andrew
I'm trying to adapt some code an ex-employee has written to perform a different function, not really too crash hot with the finer points of VBA unfortunatly. Anyone have any ideas?
Code:
Private Sub PropertyRef_AfterUpdate()
Dim rstTemp As Recordset
Dim qrydefTemp As QueryDef
Dim strSQL As String
Dim strRepairAgent As String
strSQL = "SELECT PRP_ADDRESS_1, PRP_ADDRESS_2, PRP_POST_CODE FROM xxxxxxx_WM_PROPERTY WHERE PRP_REFERENCE='" & [forms]![frmxxx]![propertyref] & "';"
Set rstTemp = CurrentDb.OpenRecordset(strSQL)
Address = rstTemp!PRP_ADDRESS_1 _
& IIf(IsNull(rstTemp!PRP_ADDRESS_2), "", " " & rstTemp!PRP_ADDRESS_2)
PostCode = rstTemp!PRP_POST_CODE
Notes:
xxxxxxx_WM_PROPERTY is a linked table in the database.
[forms]![xxx]![propertyref] is a number field in the form.
I get a type mismatch error at the line strSQL... is it because i am trying to pass the form field into the string? Is there another way of doing this?
Thanks for your help,
Andrew