Hi
I have a Main form and a Subform linked together via the staffno
On the main form there is a combobox that the user selects an employee name from.
This then populates the Main form with details like Name Address etc.
The subform is then populated with his sickness records.
What I would like to know is.
How do I if the user has no sickness in the subform hide it.
this is the following code on the AfterUpdate Combo box
What happens at the moment is that if the user has no sickness records it goes to the first record.
Thanks
Phil
I have a Main form and a Subform linked together via the staffno
On the main form there is a combobox that the user selects an employee name from.
This then populates the Main form with details like Name Address etc.
The subform is then populated with his sickness records.
What I would like to know is.
How do I if the user has no sickness in the subform hide it.
this is the following code on the AfterUpdate Combo box
Code:
Private Sub cmb_Search_AfterUpdate()
Dim rs As Object
G_STAFFNO = Me.cmb_Search.Value
Set rs = Me.Recordset.Clone
rs.FindFirst "[STAFFNO] = '" & Me![cmb_Search] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
G_STAFFNO = Me.cmb_Search
G_EForename = Me.cmb_Search.Column(1)
G_ESurname = Me.cmb_Search.Column(0)
G_EName = Me.cmb_Search.Column(1) & " " & Me.cmb_Search.Column(0)
End Sub
What happens at the moment is that if the user has no sickness records it goes to the first record.
Thanks
Phil