Popup Calendar

  • Thread starter Thread starter Nathan Lars
  • Start date Start date
N

Nathan Lars

The popup calendar I downloaded from Allen Browne's site worked in one
Database perfectly, but after I importing it into 2 other databases since
then it has not worked. Ithas to be user error, but I can't figure it out.
I receive the following message after replacing the StartDate text in the
provided On-Click Event Procedure in the Properties List with my text box
name:

"There was an error compiling this function.
The Visual Basic Module contains a syntax error.
Check the code, and then recompile it."

What am I missing?

http://allenbrowne.com/ser-51.html
 
This may be a stupid question, but...

you mention import the form, but did you import the ajbCalendar module as
well?
 
I just tried to click the button off of the frmExample in forms from the
original downloaded file and it gives me an error message:

"Microsoft Visual Basic
Run-time Error '438':

Object doesn't support this property or method"

[End] [Debug]
 
Just the button?

Did you enter

Public gtxtCalTarget As TextBox

in the form module header?


What is the code behind you button?


When you compile the code in the VBE does it compile properly?
--
Daniel Pineault
 
I am sorry I don't understand your questions as well as I would like since my
knowledge of Access is fairly basic. I don't mean to frustrate you, but what
do you mean by "Public gtxtCalTarget As TextBox"? The calendar should be
pointing to the existing Text Box in my form? My Text Box name is Project
Open, which is what I replaced for txtStartDate in the existing event
procedure for On Click.

Before:
=CalendarFor([txtStartDate],"Set the start date")

After:
=CalendarFor([Project Open],"Set the start date")

This is so it opens a calendar for the Project Open text box, right? In a
different db it worked. Does that answer your question about the code behind
my calendar button?
I didn't actually go into VBE to change the code, I just changed it in the
On Click field in the properties list for the Project Open text box.

Thank you for your help.
 
Nathan,

You're not frustrating me. We all have questions and we were all new to
access at one time or another!

but what do you mean by "Public gtxtCalTarget As TextBox"?
Well, it hard to explain so best bet is to open the sample database from
Allen's website and open the frmExample in design mode. Select the
cmdCalDate button and right-click on it and select build event from the list.
This will open the VBE at the code for that button. Now scroll to the top
of the page for that module.

It should look like:
Option Compare Database
Option Explicit

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
....

Now perform the same operation on your form and button. Check the module
page header (top of the page). Does it have the

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

at the very top before any function/sunroutine declarations? If not, please
add it, compile and save your changes and try it again.
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.



Nathan Lars said:
I am sorry I don't understand your questions as well as I would like since my
knowledge of Access is fairly basic. I don't mean to frustrate you, but what
do you mean by "Public gtxtCalTarget As TextBox"? The calendar should be
pointing to the existing Text Box in my form? My Text Box name is Project
Open, which is what I replaced for txtStartDate in the existing event
procedure for On Click.

Before:
=CalendarFor([txtStartDate],"Set the start date")

After:
=CalendarFor([Project Open],"Set the start date")

This is so it opens a calendar for the Project Open text box, right? In a
different db it worked. Does that answer your question about the code behind
my calendar button?
I didn't actually go into VBE to change the code, I just changed it in the
On Click field in the properties list for the Project Open text box.

Thank you for your help.


Daniel Pineault said:
Just the button?

Did you enter

Public gtxtCalTarget As TextBox

in the form module header?


What is the code behind you button?


When you compile the code in the VBE does it compile properly?
 
Yes it shows exactly as you described. Below was copied straight from file
downloaded from Allen's site.
See anything wrong?

....
Option Compare Database
Option Explicit

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
'On Error GoTo Err_Handler
'Purpose: Open the calendar form, identifying the text box to return
the date to.
'Arguments: txt = the text box to return the date to.
' strTitle = the caption for the calendar form (passed in
OpenArgs).

Set gtxtCalTarget = txt
DoCmd.OpenForm "frmCalendar", windowmode:=acDialog, OpenArgs:=strTitle

Exit_Handler:
Exit Function

Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, vbExclamation,
"CalendarFor()"
Resume Exit_Handler
End Function

Public Function LogError(lngErr As Long, strDescrip As String, strProc As
String, _
Optional bShowUser As Boolean = True, Optional varParam As Variant)
'Purpose: Minimal substitute for the real error logger function at:
' http://allenbrowne.com/ser-23a.html

If bShowUser Then
MsgBox "Error " & lngErr & ": " & strDescrip, vbExclamation, strProc
End If
End Function
....




Daniel Pineault said:
Nathan,

You're not frustrating me. We all have questions and we were all new to
access at one time or another!

but what do you mean by "Public gtxtCalTarget As TextBox"?
Well, it hard to explain so best bet is to open the sample database from
Allen's website and open the frmExample in design mode. Select the
cmdCalDate button and right-click on it and select build event from the list.
This will open the VBE at the code for that button. Now scroll to the top
of the page for that module.

It should look like:
Option Compare Database
Option Explicit

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
...

Now perform the same operation on your form and button. Check the module
page header (top of the page). Does it have the

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

at the very top before any function/sunroutine declarations? If not, please
add it, compile and save your changes and try it again.
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.



Nathan Lars said:
I am sorry I don't understand your questions as well as I would like since my
knowledge of Access is fairly basic. I don't mean to frustrate you, but what
do you mean by "Public gtxtCalTarget As TextBox"? The calendar should be
pointing to the existing Text Box in my form? My Text Box name is Project
Open, which is what I replaced for txtStartDate in the existing event
procedure for On Click.

Before:
=CalendarFor([txtStartDate],"Set the start date")

After:
=CalendarFor([Project Open],"Set the start date")

This is so it opens a calendar for the Project Open text box, right? In a
different db it worked. Does that answer your question about the code behind
my calendar button?
I didn't actually go into VBE to change the code, I just changed it in the
On Click field in the properties list for the Project Open text box.

Thank you for your help.


Daniel Pineault said:
Just the button?

Did you enter

Public gtxtCalTarget As TextBox

in the form module header?


What is the code behind you button?


When you compile the code in the VBE does it compile properly?
--
Daniel Pineault






:

Yes, the module too. I also copied the button into my form.

:

This may be a stupid question, but...

you mention import the form, but did you import the ajbCalendar module as
well?
--
Hope this helps,

Daniel Pineault







:

The popup calendar I downloaded from Allen Browne's site worked in one
Database perfectly, but after I importing it into 2 other databases since
then it has not worked. Ithas to be user error, but I can't figure it out.
I receive the following message after replacing the StartDate text in the
provided On-Click Event Procedure in the Properties List with my text box
name:

"There was an error compiling this function.
The Visual Basic Module contains a syntax error.
Check the code, and then recompile it."

What am I missing?

http://allenbrowne.com/ser-51.html
 
The question is at the top of your forms module does it begin with
....

Option Compare Database
Option Explicit

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

....

if not, it should!

Have you compacted and repaired your database lately?
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.



Nathan Lars said:
Yes it shows exactly as you described. Below was copied straight from file
downloaded from Allen's site.
See anything wrong?

...
Option Compare Database
Option Explicit

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
'On Error GoTo Err_Handler
'Purpose: Open the calendar form, identifying the text box to return
the date to.
'Arguments: txt = the text box to return the date to.
' strTitle = the caption for the calendar form (passed in
OpenArgs).

Set gtxtCalTarget = txt
DoCmd.OpenForm "frmCalendar", windowmode:=acDialog, OpenArgs:=strTitle

Exit_Handler:
Exit Function

Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, vbExclamation,
"CalendarFor()"
Resume Exit_Handler
End Function

Public Function LogError(lngErr As Long, strDescrip As String, strProc As
String, _
Optional bShowUser As Boolean = True, Optional varParam As Variant)
'Purpose: Minimal substitute for the real error logger function at:
' http://allenbrowne.com/ser-23a.html

If bShowUser Then
MsgBox "Error " & lngErr & ": " & strDescrip, vbExclamation, strProc
End If
End Function
...




Daniel Pineault said:
Nathan,

You're not frustrating me. We all have questions and we were all new to
access at one time or another!

but what do you mean by "Public gtxtCalTarget As TextBox"?
Well, it hard to explain so best bet is to open the sample database from
Allen's website and open the frmExample in design mode. Select the
cmdCalDate button and right-click on it and select build event from the list.
This will open the VBE at the code for that button. Now scroll to the top
of the page for that module.

It should look like:
Option Compare Database
Option Explicit

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
...

Now perform the same operation on your form and button. Check the module
page header (top of the page). Does it have the

'Calendar form variable:
Public gtxtCalTarget As TextBox 'Text box to return the date from the
calendar to.

at the very top before any function/sunroutine declarations? If not, please
add it, compile and save your changes and try it again.
--
Hope this helps,

Daniel Pineault
If this post was helpful, please rate it by using the vote buttons.



Nathan Lars said:
I am sorry I don't understand your questions as well as I would like since my
knowledge of Access is fairly basic. I don't mean to frustrate you, but what
do you mean by "Public gtxtCalTarget As TextBox"? The calendar should be
pointing to the existing Text Box in my form? My Text Box name is Project
Open, which is what I replaced for txtStartDate in the existing event
procedure for On Click.

Before:
=CalendarFor([txtStartDate],"Set the start date")

After:
=CalendarFor([Project Open],"Set the start date")

This is so it opens a calendar for the Project Open text box, right? In a
different db it worked. Does that answer your question about the code behind
my calendar button?
I didn't actually go into VBE to change the code, I just changed it in the
On Click field in the properties list for the Project Open text box.

Thank you for your help.


:

Just the button?

Did you enter

Public gtxtCalTarget As TextBox

in the form module header?


What is the code behind you button?


When you compile the code in the VBE does it compile properly?
--
Daniel Pineault






:

Yes, the module too. I also copied the button into my form.

:

This may be a stupid question, but...

you mention import the form, but did you import the ajbCalendar module as
well?
--
Hope this helps,

Daniel Pineault







:

The popup calendar I downloaded from Allen Browne's site worked in one
Database perfectly, but after I importing it into 2 other databases since
then it has not worked. Ithas to be user error, but I can't figure it out.
I receive the following message after replacing the StartDate text in the
provided On-Click Event Procedure in the Properties List with my text box
name:

"There was an error compiling this function.
The Visual Basic Module contains a syntax error.
Check the code, and then recompile it."

What am I missing?

http://allenbrowne.com/ser-51.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top