A
Andrew C
Hi
On my main form i have a command button which currently opens another form
based upon the the staff member selected in a combo box. (Works OK) The
form it opens has the staff member field at the top and then a subform
underneath with reords of that staff member.
Wnat i want to add in a start date and end date fields to the main form. So
that when you enter a date it will show the staff members records on that
date or between the to dates.
Also i would like it that if there is no staff member selected it will show
all records and no dates entered it will show all records.
Below is what code i have so far:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Staff Contact"
stLinkCriteria = "[Contact.Staff Member]=" & Me![Combo13]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dim strForm As String
strForm = "Main"
If CurrentProject.AllForms(strForm).IsLoaded Then
DoCmd.Close acForm, strForm
End If
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
If you need more information just ask. Im not an advance user of access but
i know my way around.
Thanks
On my main form i have a command button which currently opens another form
based upon the the staff member selected in a combo box. (Works OK) The
form it opens has the staff member field at the top and then a subform
underneath with reords of that staff member.
Wnat i want to add in a start date and end date fields to the main form. So
that when you enter a date it will show the staff members records on that
date or between the to dates.
Also i would like it that if there is no staff member selected it will show
all records and no dates entered it will show all records.
Below is what code i have so far:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Staff Contact"
stLinkCriteria = "[Contact.Staff Member]=" & Me![Combo13]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dim strForm As String
strForm = "Main"
If CurrentProject.AllForms(strForm).IsLoaded Then
DoCmd.Close acForm, strForm
End If
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
If you need more information just ask. Im not an advance user of access but
i know my way around.
Thanks