PC Review


Reply
Thread Tools Rate Thread

Calendar Pop-Up in Access (VBA)

 
 
=?Utf-8?B?Q2FsZ2FyeURhdGFHaXJs?=
Guest
Posts: n/a
 
      19th Apr 2006
I am trying to run a pop-up calendar in Access (I am a SQL girl... not
familiar with VB code) and I can't seem to figure out why I keep getting this
error:

Run-time error '91':
Object variable or With block variable not set

Can anyone help tell me what is wrong here? Here is my code:

Option Compare Database
Option Explicit
Dim cboOriginator As ComboBox

Private Sub cboStartDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
' Note which combo box called the calendar
Set cboOriginator = cboStartDate
' Unhide the calendar and give it the focus
Calendar6.Visible = True
Calendar6.SetFocus
' Match calendar date to existing date if present or today's date
If Not IsNull(cboOriginator) Then
Calendar6.Value = cboOriginator.Value
Else
Calendar6.Value = Date
End If
End Sub

Private Sub cboEndDate_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
' Note which combo box called the calendar
Set cboOriginator = cboEndDate
' Unhide the calendar and give it the focus
Calendar6.Visible = True
Calendar6.SetFocus
' Match calendar date to existing date if present or today's date
If Not IsNull(cboOriginator) Then
Calendar6.Value = cboOriginator.Value
Else
Calendar6.Value = Date
End If
End Sub

Private Sub Calendar6_Click()
' Copy chosen date from calendar to originating combo box
cboOriginator.Value = Calendar6.Value ----- this is where it is
highlighted ----
' Return the focus to the combo box and hide the calendar and
cboOriginator.SetFocus
Calendar6.Visible = False
' Empty the variable
Set cboOriginator.Value = Nothing
End Sub

Thanks! Stacy

 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGVubmlz?=
Guest
Posts: n/a
 
      20th Apr 2006
EXACTLY what line generates the error?

"CalgaryDataGirl" wrote:

> I am trying to run a pop-up calendar in Access (I am a SQL girl... not
> familiar with VB code) and I can't seem to figure out why I keep getting this
> error:
>
> Run-time error '91':
> Object variable or With block variable not set
>
> Can anyone help tell me what is wrong here? Here is my code:
>
> Option Compare Database
> Option Explicit
> Dim cboOriginator As ComboBox
>
> Private Sub cboStartDate_MouseDown(Button As Integer, Shift As Integer, X As
> Single, Y As Single)
> ' Note which combo box called the calendar
> Set cboOriginator = cboStartDate
> ' Unhide the calendar and give it the focus
> Calendar6.Visible = True
> Calendar6.SetFocus
> ' Match calendar date to existing date if present or today's date
> If Not IsNull(cboOriginator) Then
> Calendar6.Value = cboOriginator.Value
> Else
> Calendar6.Value = Date
> End If
> End Sub
>
> Private Sub cboEndDate_MouseDown(Button As Integer, Shift As Integer, X As
> Single, Y As Single)
> ' Note which combo box called the calendar
> Set cboOriginator = cboEndDate
> ' Unhide the calendar and give it the focus
> Calendar6.Visible = True
> Calendar6.SetFocus
> ' Match calendar date to existing date if present or today's date
> If Not IsNull(cboOriginator) Then
> Calendar6.Value = cboOriginator.Value
> Else
> Calendar6.Value = Date
> End If
> End Sub
>
> Private Sub Calendar6_Click()
> ' Copy chosen date from calendar to originating combo box
> cboOriginator.Value = Calendar6.Value ----- this is where it is
> highlighted ----
> ' Return the focus to the combo box and hide the calendar and
> cboOriginator.SetFocus
> Calendar6.Visible = False
> ' Empty the variable
> Set cboOriginator.Value = Nothing
> End Sub
>
> Thanks! Stacy
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sync sharepoint calendar to outlook web access calendar? Alzee Microsoft Outlook Calendar 7 8th Sep 2008 09:45 AM
Calendar Controls in Access 2002: MSCAL.Calendar.7 =?Utf-8?B?QWNjZXNzMTAx?= Microsoft Access Forms 7 23rd Nov 2006 08:10 PM
Using outlook://calendar link to access other user's calendar =?Utf-8?B?QUQ=?= Microsoft Outlook Calendar 0 28th Oct 2005 06:45 PM
Linking MS-Access Calendar to Outlook's Calendar Charles L. Phillips Microsoft Access Forms 0 26th Jun 2005 07:13 AM
Setting calendar permissions when you are owner of calendar folder only (no access to open rest of mailbox) Joseph Hill Microsoft Outlook 3 29th Sep 2004 09:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:43 PM.