From: Konchetta via AccessMonster.com on 29 Apr 2010 16:11 This code was working at first with the help of the experts on this site but I went on a 2 week Military Training and came back to finish up this database and now it's giving me an error of "Error 94 Invalid Use of Null". What in creation could have happened? This is my code. Could it be the formatting on the form? I think I changed the formatting of cells and am not using some of the fields. Please HELP!! Private Sub AddAppt_Click() On Error GoTo AddAppt_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 Microsoft Outlook" 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 = Me!ApptDate & " " & Me!ApptTime .Duration = Me!ApptLength .Subject = Me!Appt If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes If Not IsNull(Me!ApptLocation) Then .Location = _ Me!ApptLocation If Me!ApptReminder 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 "Appointment Added!" Exit Sub AddAppt_Err: MsgBox "Error " & Err.Number & vbCrLf & Err.Description Exit Sub End Sub -- Message posted via http://www.accessmonster.com
From: Konchetta via AccessMonster.com on 29 Apr 2010 16:30 I got it working for now.. had deleted a field that I guess needs to be on the form obviously. Konchetta wrote: >This code was working at first with the help of the experts on this site but >I went on a 2 week Military Training and came back to finish up this database >and now it's giving me an error of "Error 94 Invalid Use of Null". What in >creation could have happened? This is my code. Could it be the formatting on >the form? I think I changed the formatting of cells and am not using some of >the fields. Please HELP!! > >Private Sub AddAppt_Click() > On Error GoTo AddAppt_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 Microsoft Outlook" > 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 = Me!ApptDate & " " & Me!ApptTime > .Duration = Me!ApptLength > .Subject = Me!Appt > If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes > If Not IsNull(Me!ApptLocation) Then .Location = _ > Me!ApptLocation > If Me!ApptReminder 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 "Appointment Added!" > Exit Sub >AddAppt_Err: > MsgBox "Error " & Err.Number & vbCrLf & Err.Description > Exit Sub > End Sub -- Message posted via http://www.accessmonster.com
From: Konchetta via AccessMonster.com on 29 Apr 2010 16:30 I got it working for now.. had deleted a field that I guess needs to be on the form obviously. Konchetta wrote: >This code was working at first with the help of the experts on this site but >I went on a 2 week Military Training and came back to finish up this database >and now it's giving me an error of "Error 94 Invalid Use of Null". What in >creation could have happened? This is my code. Could it be the formatting on >the form? I think I changed the formatting of cells and am not using some of >the fields. Please HELP!! > >Private Sub AddAppt_Click() > On Error GoTo AddAppt_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 Microsoft Outlook" > 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 = Me!ApptDate & " " & Me!ApptTime > .Duration = Me!ApptLength > .Subject = Me!Appt > If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes > If Not IsNull(Me!ApptLocation) Then .Location = _ > Me!ApptLocation > If Me!ApptReminder 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 "Appointment Added!" > Exit Sub >AddAppt_Err: > MsgBox "Error " & Err.Number & vbCrLf & Err.Description > Exit Sub > End Sub -- Message posted via http://www.accessmonster.com
|
Pages: 1 Prev: hidden form Next: Clear Unbound Text box used as input parameter to query |