By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,742 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,742 IT Pros & Developers. It's quick & easy.

My Calendar control button stopped working.

P: n/a
After opening and clicking on the popup calendar command control
button, "fdlgCal"; I click on a given date. The date is suppose to
then appear in a date field next to the control. Instead, I get the
following error:

"Microsoft Office Access

The expression On Click you entered as the event
property setting
produced the following error: The expression you
entered has a function
name that Microsoft Office Access can't find.

*The expression may not result in the name of a macro,
the name of a user-defined
function, or [Event Procedure].

* There may have been an error evaluating the function,
event, or macro."

Every thing use to work. My fear is that I changed one thing to many
during the process of debugging my whole application, and ended up
breaking this function.

Below is a description of how I have things set up:

1. I have a form called: "Employee"

2. It has a date field with the Control Source/Name: "startdte"

3. Next to this field is a calendar button named "Command100" with
an On Click Event Procedure written as follows:

"Private Sub Command100_Click()
On Error GoTo ErrLine
startdte = CalendarDlg(startdte)
ExitLine:
Exit Sub
ErrLine:
Resume ExitLine
End Sub"
4. Under my list of Modules; I have a module called "basCalDlg"
with the following Visual Basic Code:

"Option Compare Database 'Use database order for string comparisons
Option Explicit

Private Const cCalendarDialog = "fdlgCal"
'Const cModule = "basCalDlg"

Public Function CalendarDlg(Optional ByVal vPassedDate As Variant) As
Variant
'
' This is the public entry point.
' If the passed in date is missing (as it will be if someone just
opens the Calendar form),
' start on the current day. Otherwise, start with the date that is
passed in.
On Error GoTo ErrLine

Dim vStartDate As Variant

' If they passed a value at all, attempt to use it as the start
date.
vStartDate = IIf(IsMissing(vPassedDate), date, vPassedDate)
' OK, so they passed a value that wasn't a date. Just use today's
date in that case, too.
If Not IsDate(vStartDate) Then vStartDate = date
DoCmd.OpenForm FormName:=cCalendarDialog, WindowMode:=acDialog,
OpenArgs:=vStartDate

' You won't get here until the calendar dialog is closed or hidden.
'
' If the calendar dialog is still loaded get the final chosen date
from the form.
' If it isn't, return Null.
If IsFormOpen(cCalendarDialog) Then
CalendarDlg = Forms(cCalendarDialog).Value
DoCmd.Close acForm, cCalendarDialog
Else
CalendarDlg = IIf(IsDate(vPassedDate), vPassedDate, Null)
End If

ExitLine:
Exit Function
ErrLine:
Resume ExitLine
End Function"

John

Oct 13 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.