I am having some issues with my database. I am trying to accomplish the following:
Allow the user to enter a date and display all
members that joined the school with respect to
that date. Include on the form 2 radio buttons
that will allow the user to select if he wishes to
display dates before the given date or on or
post the given date. The date should be
selected using a DateTimePicker control. If no
date has been selected by the user, the current
date should be supplied to the query.
Here is my interface for my frmEnterDate.
Attachment 99107
And here is my code for the Display Members button.
I am trying to think of ways to have the radio buttons select what range of dates should be displayed. I have some ideas and have tried setting datasets for each radio buttons, and binding them to the DataTimePicker control in the following way. (In this case, I created a dataset called BeforeDateDataSet):
In my query for the BeforeDateDataSet, I have a table called Member selected with the following query:
Of course, when I write the syntax for the Display button, I get an error, and I know that my code does not make much sense, but I am really trying. I am not asking anyone to give me all the answers, I am simply asking for some ideas on how to accomplish the tasks.
Quote:
Allow the user to enter a date and display all
members that joined the school with respect to
that date. Include on the form 2 radio buttons
that will allow the user to select if he wishes to
display dates before the given date or on or
post the given date. The date should be
selected using a DateTimePicker control. If no
date has been selected by the user, the current
date should be supplied to the query.
Attachment 99107
And here is my code for the Display Members button.
Code:
Private Sub mnuFileClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuFileClose.Click
Me.Close()
End Sub
Private Sub btnDisplayMembers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayMembers.Click
Me.MembersTableAdapter.Fill(Me.EnterDateDataSet.Members, CDate(txtEnterDate.Text))
End SubCode:
Private Sub btnDisplayMembers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayMembers.Click
Me.MembersTableAdapter.Fill(Me.EnterDateDataSet.Members, CDate(txtEnterDate.Text))
If radBeforeDate.Checked = True Then
Me.MembersTableAdapter.Fill(Me.BeforeDateDataSet.Members, DateTimePicker.Value)
End If
End SubCode:
SELECT Last_Name, First_Name, Date_Joined
FROM Members
WHERE (Date_Joined < @Date_Joined)