Using Access 2003, Access 2000 format
An unbound form called "frmMakeupActivities". This is used to enter a Member's name, the date of the Makeup Activity, the type of Makeup Activity, and the # of hours spent.
A single select list box, lstMemberID, is on the form. Its SQL is
The user selects a Member, a Date of Activity, a type of Activity from another list box called lstMakeupType, and the # of hours, if an Hours entry is desired (sometimes not). Then the user presses a Post command button to post the data to tblAttendance. The SQL behind the Post command button is
Now, 2 or more Members may well involve themselves in the same Makeup Activity on the same date...however, the # of hours spent may or may not be the same. For this reason I have restricted the form to the entry of 1 member and one activity at a time.
However, it would be quicker for the user to select more than one member at the same time, and for the same date. The CLINKER is the # of Hours, which may or may not be the same...and the Hours entry may be anywhere from blank to any given number.
Any suggestion to push me in the right direction.
Tom
An unbound form called "frmMakeupActivities". This is used to enter a Member's name, the date of the Makeup Activity, the type of Makeup Activity, and the # of hours spent.
A single select list box, lstMemberID, is on the form. Its SQL is
Code:
SELECT tblMembers.MemberID, [LastName] & ", " & [PreferredName] AS FullName, tblMembers.LastName, tblMembers.PreferredName, tblMembers.Status
FROM tblMembers
WHERE (((tblMembers.Status)="Active" Or (tblMembers.Status)="Senior"))
ORDER BY tblMembers.LastName, tblMembers.PreferredName;
The user selects a Member, a Date of Activity, a type of Activity from another list box called lstMakeupType, and the # of hours, if an Hours entry is desired (sometimes not). Then the user presses a Post command button to post the data to tblAttendance. The SQL behind the Post command button is
Code:
Private Sub cmdPost_Click()
On Error GoTo Err_cmdPost_Click
Dim sql As String
If IsNull(Me.lstMemberID) Then
MsgBox "Please select Member from list.", vbExclamation, "Member needed"
Me.Undo
Me.lstMemberID.SetFocus
Exit Sub
'End If
ElseIf IsNull(Me.txtMeetingDate) Then
MsgBox "Record cannot be saved without a Makeup Date!", vbExclamation, "Makeup Date required."
Me.Undo
Me.txtMeetingDate.SetFocus
Exit Sub
'End If
ElseIf IsNull(Me.lstMakeupType) Then
MsgBox "Please select Makeup Meeting Type from list.", vbExclamation, "Makeup Meeting Type needed"
Me.Undo
Me.lstMakeupType.SetFocus
Exit Sub
'End If
ElseIf IsNull(Me.txtHours) Then
Select Case MsgBox("Do you wish to enter" _
& vbCrLf & " HOURS" _
& vbCrLf & " for this Activity?" _
, vbYesNo Or vbExclamation Or vbDefaultButton1, "Check for Hours")
Case vbYes
Me.Undo
Me.txtHours.SetFocus
Exit Sub
Case vbNo
GoTo PostProcedure
End Select
Exit Sub
End If
PostProcedure:
DoCmd.SetWarnings False
sql = "INSERT INTO tblAttendance(MemberID, MeetingDate, Present, MeetingTypeID, MakeupID, Comments, HoursSpent) VALUES(Forms!frmMakeUpActivities!lstMemberID , #" & Me.txtMeetingDate & "#, True,2,Forms!frmMakeUpActivities!lstMakeupType, Forms!frmMakeUpActivities!txtComments, Forms!frmMakeUpActivities!txtHours)"
DoCmd.RunSQL sql
DoCmd.SetWarnings True
Dim Response As Variant
Dim Response2 As Variant
Dim MyDate As Date
MyDate = Me.txtMeetingDate
Response = MsgBox("Do you wish to Post another Makeup Meeting?", vbYesNo, "Posting check")
If Response = vbYes Then
Response2 = MsgBox("For the SAME Date or a DIFFERENT Date?" _
& vbCrLf & vbCrLf & "If SAME Date select <Yes>, if DIFFERENT Date select <No>.", vbYesNo, "Same or Different Date check")
If Response2 = vbYes Then
Me.lstMemberID = Null
Me.lstMakeupType = Null
Me.txtHours = ""
Me.lstMemberID.SetFocus
Else
Me.txtMeetingDate = Null
Me.lstMemberID = Null
Me.lstMakeupType = Null
Me.txtHours = ""
Me.txtMeetingDate.SetFocus
End If
Else
DoCmd.Close
DoCmd.OpenForm "frmMainMenu"
End If
Exit_cmdPost_Click:
Exit Sub
Err_cmdPost_Click:
MsgBox Err.Description
Resume Exit_cmdPost_Click
End Sub
Now, 2 or more Members may well involve themselves in the same Makeup Activity on the same date...however, the # of hours spent may or may not be the same. For this reason I have restricted the form to the entry of 1 member and one activity at a time.
However, it would be quicker for the user to select more than one member at the same time, and for the same date. The CLINKER is the # of Hours, which may or may not be the same...and the Hours entry may be anywhere from blank to any given number.
Any suggestion to push me in the right direction.
Tom