M
mnsebastian
What I have is a main form that has a combo box when the asset is
selected the subform is populated with vendors within a certain radius.
.. . This works fine, below is the 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
Set qdf = CurrentDb.QueryDefs("Get20Mile_SelQry")
qdf.Parameters(0) = Forms![FrmMain]![txtZipCode]
Set rst = qdf.OpenRecordset(dbOpenDynaset)
Set [fsubProperties].Form.Recordset = rst
If rst.RecordCount = 0 Then
DoCmd.OpenForm ("frmError"), acNormal
End If
End If
End Sub
But if there aren't any vendors within the radius then a new form opens
frmError
If the user selects the next closest vendor then I want the subform
(fsubproperties) to populate with the results from the
GetFirstRecordinQuery_selQry Results. Here is my code
Private Sub cmdNextRecord_Click()
Dim db As Database
Dim rst As DAO.Recordset
Dim qdf As QueryDef
DoCmd.OpenForm ("fsubproperties")
Set qdf = CurrentDb.QueryDefs("GetFirstRecordInQuery_SelQry")
qdf.Parameters(0) = Forms![FrmMain]![txtZipCode]
Set rst = qdf.OpenRecordset(dbOpenDynaset)
Set Forms(fsubProperties).Form.Recordset = rst
End Sub
Unfortunately, it is doing nothing the subform is empty (in fact I
think it is closed).
Thanks for your help!
selected the subform is populated with vendors within a certain radius.
.. . This works fine, below is the 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
Set qdf = CurrentDb.QueryDefs("Get20Mile_SelQry")
qdf.Parameters(0) = Forms![FrmMain]![txtZipCode]
Set rst = qdf.OpenRecordset(dbOpenDynaset)
Set [fsubProperties].Form.Recordset = rst
If rst.RecordCount = 0 Then
DoCmd.OpenForm ("frmError"), acNormal
End If
End If
End Sub
But if there aren't any vendors within the radius then a new form opens
frmError
If the user selects the next closest vendor then I want the subform
(fsubproperties) to populate with the results from the
GetFirstRecordinQuery_selQry Results. Here is my code
Private Sub cmdNextRecord_Click()
Dim db As Database
Dim rst As DAO.Recordset
Dim qdf As QueryDef
DoCmd.OpenForm ("fsubproperties")
Set qdf = CurrentDb.QueryDefs("GetFirstRecordInQuery_SelQry")
qdf.Parameters(0) = Forms![FrmMain]![txtZipCode]
Set rst = qdf.OpenRecordset(dbOpenDynaset)
Set Forms(fsubProperties).Form.Recordset = rst
End Sub
Unfortunately, it is doing nothing the subform is empty (in fact I
think it is closed).
Thanks for your help!