I have a production database where certain items are being utilitzed throughout the day. Individuals are able to schedule (through the form onto Microsoft Outlook) the 'appointments' / 'securitization' of the items for a certain time period (user input). I am now trying to figure out if someone can click a checkbox (ASAP button) where the item will be reserved at the next possible time or times. For example:
Bob reserves the item from 8-10
Joe reserves the item from 12-2
(leaving open 10-12 and 2+)
Mary wants to use the item for 4 hrs...whenever it is free...rather than view the schedule, adjust her entries...I would like Mary to click the checkbox and the item would be reserved at the next available times (10-12 and 2-4)...Does this make sense?
I have pasted my VB code below for someone to view...
Private Sub addjob_Click()
On Error GoTo AddJob_Err
' Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
' Exit the procedure if appointment has been added to Outlook.
If Me!AddedtoOutlook = True Then
MsgBox "This appointment already added to the Production Schedule"
Exit Sub
' Add a new appointment.
Else
Dim outobj As Outlook.Application
Dim outappt As Outlook.AppointmentItem
Set outobj = CreateObject("outlook.application"
Set outappt = outobj.CreateItem(olAppointmentItem)
With outappt
'Start time is next available time
.Start = Me!JobDate & " " & Me!JobTime
.Duration = Me!JobLength
.Subject = Me!Job
If Not IsNull(Me!JobNotes) Then .Body = Me!JobNotes
If Not IsNull(Me!JobLocation) Then .Location = _
Me!JobLocation
If Me!JobReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If
.Save
End With
End If
' Release the Outlook object variable.
Set outobj = Nothing
' Set the AddedToOutlook flag, save the record, display a message.
Me!AddedtoOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Job Added!"
DoCmd.SendObject , , , "david@energytechlabs.com", , , "New Print Request", "Hello, there is a new print request!", No
Exit Sub
AddJob_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Thanks for everyone's help in advance...
Bob reserves the item from 8-10
Joe reserves the item from 12-2
(leaving open 10-12 and 2+)
Mary wants to use the item for 4 hrs...whenever it is free...rather than view the schedule, adjust her entries...I would like Mary to click the checkbox and the item would be reserved at the next available times (10-12 and 2-4)...Does this make sense?
I have pasted my VB code below for someone to view...
Private Sub addjob_Click()
On Error GoTo AddJob_Err
' Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
' Exit the procedure if appointment has been added to Outlook.
If Me!AddedtoOutlook = True Then
MsgBox "This appointment already added to the Production Schedule"
Exit Sub
' Add a new appointment.
Else
Dim outobj As Outlook.Application
Dim outappt As Outlook.AppointmentItem
Set outobj = CreateObject("outlook.application"
Set outappt = outobj.CreateItem(olAppointmentItem)
With outappt
'Start time is next available time
.Start = Me!JobDate & " " & Me!JobTime
.Duration = Me!JobLength
.Subject = Me!Job
If Not IsNull(Me!JobNotes) Then .Body = Me!JobNotes
If Not IsNull(Me!JobLocation) Then .Location = _
Me!JobLocation
If Me!JobReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If
.Save
End With
End If
' Release the Outlook object variable.
Set outobj = Nothing
' Set the AddedToOutlook flag, save the record, display a message.
Me!AddedtoOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Job Added!"
DoCmd.SendObject , , , "david@energytechlabs.com", , , "New Print Request", "Hello, there is a new print request!", No
Exit Sub
AddJob_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
End Sub
Thanks for everyone's help in advance...