From: barnstar via AccessMonster.com on
Barry

Thank you for your help, it is certainly a start but a very long way to go.

Barnstar

Barry A&P wrote:
>Barnstar
>I am also new to access an have greatly enjoyed trying to figure out how to
>do the things i want to do..
>Since i havent seen any specific suggestions on your setup let me throw out
>my two cents.. on at least a newbies suggestion how to start.
>
>i would think you need an employees table
>T_Employees
>EmployeeID (PK)
>FName
>LName
>and whatever else you want in the table
>
>A Leave table
>T_Leave
>LeaveID (PK)
>EmployeeID (FK)
>LeaveStartTime
>LeaveStopTime
>
>then you could have a form F_LeaveRequest with the employees info and two
>unbound boxes for LeavestartTime and LeaveStopTime
>and a Submit Leave Button
>
>in the buttons on-click event start with something like this
>
>Private Sub CMD_Submit_Click()
>Dim MatchCount As Integer
>
>If IsNull([Forms]![F_LeaveRequest]![LeaveStartTime]) Or
>IsNull([Forms]![F_LeaveRequest]![LeavestopTime]) Then
>MsgBox "Start or End Time cant be Empty", vbOKOnly
>Else
>
>If DCount("leaveID", "T_Leave", "T_Leave.LeaveStartTime Between
>[Forms]![F_LeaveRequest]![LeaveStartTime] And
>[Forms]![F_LeaveRequest]![LeaveStopTime] OR T_Leave.LeaveStopTime Between
>[Forms]![F_LeaveRequest]![LeaveStartTime] And
>[Forms]![F_LeaveRequest]![LeaveStopTime]") > 0 Then
>MsgBox "somebody allready has requested leave during that period", vbOKOnly
>Else
> If MsgBox("The leave you requested is available", vbOKCancel) =
>vbCancel Then
> Exit Sub
> Else
> 'SetWarnings = False 'Un-Comment this to stop the update warnings
>Please Be carefull when turning warnings off
> DoCmd.RunSQL "INSERT INTO T_Leave ( LeaveStartTime, LeaveStopTime,
>EmployeeID ) " & _
> "SELECT [Forms]![F_LeaveRequest]![LeaveStartTime] AS LeaveStartTime,
>" & _
> "[Forms]![F_LeaveRequest]![LeaveStopTime] AS LeavestopTime, " & _
> "[Forms]![F_LeaveRequest]![EmployeeID] AS EmployeeID"
> SetWarnings = True
> End If
> End If
>End If
>
>End Sub
>
>Of course there is a Ton more stuff you need to accomplish but sometimes a
>little something to get the ball rolling helps alot
>
>Duane Hookum has a CalendarReports.mdb sample that might have a good example
>of a timeline type report that may help spot available Leave periods
>
>Remember this is newbie ramblings so i Hope i dont send you off on the wrong
>track
>Have fun
>Barry
>
>> Hi I am quite new to Access but I am desperate to learn as much as I can as
>> fast as I can.
>[quoted text clipped - 16 lines]
>>
>> .

--
Message posted via http://www.accessmonster.com