Hello,
I'm trying to update my subform with a recordset. Unfortunately, it is only listing the last record over and over again. I know I need to create a count, but I'm not sure how to accomplish this. Below is my code:
Please help!
I'm trying to update my subform with a recordset. Unfortunately, it is only listing the last record over and over again. I know I need to create a count, but I'm not sure how to accomplish this. Below is my code:
Code:
Private Sub cboAssetNumber_AfterUpdate()
If Not IsNull(Me!cboAssetNumber) Then
Me!txtAddress1 = Me!cboAssetNumber.Column(1)
Me!txtCity = Me!cboAssetNumber.Column(2)
Me!txtState = Me!cboAssetNumber.Column(3)
Me!txtZipCode = Me!cboAssetNumber.Column(4)
Dim db As Database
Dim rst As DAO.Recordset
Dim qdf As QueryDef
Dim intd As Long
Set qdf = CurrentDb.QueryDefs("Get20Mile_SelQry")
qdf.Parameters(0) = Forms![frmmain]![txtZipCode]
Set rst = qdf.OpenRecordset(dbOpenDynaset)
Set [fsubProperties].Form.Recordset = rst
With rst
Do Until .EOF
[Forms]![frmmain]![fsubProperties]![Miles] = rst("Miles")
[Forms]![frmmain]![fsubProperties]![txtCompanyName] = rst("CompanyName")
[Forms]![frmmain]![fsubProperties]![txtContactName] = rst("ContactName")
[Forms]![frmmain]![fsubProperties]![txtOfficePhone] = rst("OfficePhone")
[Forms]![frmmain]![fsubProperties]![txtMLA] = rst("MLA Signed")
[Forms]![frmmain]![fsubProperties]![txtActiveAssets] = rst("ActiveAssets") & "/" & rst("MaxAssetsAssigned")
[Forms]![frmmain]![fsubProperties]![txtLicense] = rst("Licensed Expired")
.MoveNext
Loop
End With
End If
End Sub
Please help!