Hey there,
I have an bound form with in the header an unbound combox. So, the detail section shows the results of the combox. In the from footer I put a subform. Everything works fine once you have chosen your value from the combobox (list of values).
My problem is that when I open the form it will not show the details of the default combobox value. Instead it shows all the values in the detail section. Only when you select a value from the box it will start showing the correct corresponding details.
So, what I would like to know is how to open the form with the detail section immediately showing the record details of the default value in the combobox.
I tried to put some code in an event procedure on loading the form. But I have little VBA knowledge. I tried:
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim strCriteria As String
Dim frm_fut_exp As Object
strCriteria = " [cmdChooseClass]='Strategic'"
Set rst = frm_fut_exp.RecordsetClone
With rst
.FindFirst (strCriteria)
End With
frm_fit_exp.Bookmark=rst.Bookmark
Set rst = Nothing
DoCmd.GoToControl "cmdChooseClass"
End Sub
It gives me a runtime error 91. Object variable not set. Looks straight forward, but I don't know what to change or if this really is the code to achieve a reactivation of the combobox. Or maybe there is another solution?
Thanks very much for all your help !!!
I have an bound form with in the header an unbound combox. So, the detail section shows the results of the combox. In the from footer I put a subform. Everything works fine once you have chosen your value from the combobox (list of values).
My problem is that when I open the form it will not show the details of the default combobox value. Instead it shows all the values in the detail section. Only when you select a value from the box it will start showing the correct corresponding details.
So, what I would like to know is how to open the form with the detail section immediately showing the record details of the default value in the combobox.
I tried to put some code in an event procedure on loading the form. But I have little VBA knowledge. I tried:
Private Sub Form_Load()
Dim rst As DAO.Recordset
Dim strCriteria As String
Dim frm_fut_exp As Object
strCriteria = " [cmdChooseClass]='Strategic'"
Set rst = frm_fut_exp.RecordsetClone
With rst
.FindFirst (strCriteria)
End With
frm_fit_exp.Bookmark=rst.Bookmark
Set rst = Nothing
DoCmd.GoToControl "cmdChooseClass"
End Sub
It gives me a runtime error 91. Object variable not set. Looks straight forward, but I don't know what to change or if this really is the code to achieve a reactivation of the combobox. Or maybe there is another solution?
Thanks very much for all your help !!!