skyline666
Programmer
Hi,
A user selects a project from a combo box on a form, and then clicks a command button to open up a different form which shows all risks for that project. The form is called RiskRegister, and has a subform called Risk (which shows all the risks). In the table Risk, there is a field called Status, and what I would like to do is open up the form/subform and display all risks where Status equals Open. I tried this code with no success:
The error I get is "Cant find the form RiskRegister referred in the VB code". If I take out the stLinkCriteria it works fine albeit showing all risks.
Many thanks in advance,
Andrew
A user selects a project from a combo box on a form, and then clicks a command button to open up a different form which shows all risks for that project. The form is called RiskRegister, and has a subform called Risk (which shows all the risks). In the table Risk, there is a field called Status, and what I would like to do is open up the form/subform and display all risks where Status equals Open. I tried this code with no success:
Code:
Private Sub cmbOpenRiskRegister_Click()
On Error GoTo Err_cmbOpenRiskRegister_Click
Dim stLinkCriteria As String
stLinkCriteria = Forms!RiskRegister!Risk.Form.Status = "Open"
DoCmd.OpenForm "RiskRegister", acNormal, , stLinkCriteria, , acNormal
Me.Visible = False
Exit_cmbOpenRiskRegister_Click:
Exit Sub
Err_cmbOpenRiskRegister_Click:
MsgBox Err.Description
Resume Exit_cmbOpenRiskRegister_Click
End Sub
The error I get is "Cant find the form RiskRegister referred in the VB code". If I take out the stLinkCriteria it works fine albeit showing all risks.
Many thanks in advance,
Andrew