Installing Lebans Calendar

G

Guest

I've downloaded the Lebans calendar, but do not know how to "integrate" it into my Db. I get by in Access by using Expression/Macro Builders, but I know very little of VB programming.

My logic has been to: 1) copy the Lebans modules and fields to my Db, 2) search the VB code for references to form and table names in the Lebans Db, and 3) rename them. I continue to get "Ambiguous name" errors

Any tips on how best to import? Are there any read me notes available?

The Lebans calender is ideal for my purposes!!
 
J

Jeff Conrad

Hi Pete,

You have chosen wisely; Sensei Leban's
Calendar is very slick. I think I can help on this one.

Here's a past post of mine which gives step-by step instructions.
Please try this on a BACK-UP COPY of your database first!

In your database:
1. Import the five modules (File-->Get External Data--
Import) from the Access 2000 demo database into your
database.

2. Immediately compile your database befoer doing anything else! If it
doesn't
compile, Stephen will have to help with that one.

3. Now in your database open the form in design view. Go
to the code window behind the form. In the Declarations
area (very top) you need to add one line of code. So the
very first three lines of your code window will look like
this:

Option Compare Database
Option Explicit

Private mc As clsMonthCal

4. Now go the Form's Load event and enter this one line of
code:

Set mc = New clsMonthCal

5. Now go to the Form's Unload event and enter the
following code:

If Not mc Is Nothing Then
If mc.IsCalendar Then
Cancel = 1
Exit Sub
End If
Set mc = Nothing
End If

6. Now find the CONTROL on the form that you wish to have
the calendar fill the date. Right Click on the control and
go to Properties from the list. On the "All" or "Event"
tab you should see an option that says "On Dbl Click". Hit
the little (...) button and it will take you to the code
window again. We need to add one line of code like this:

Me.txtDate=ShowMonthCalendar(mc,Nz(Me.txtDate, 1),,False)

In my example the contol name was txtDate. Change that
part to whatever you have named your control.

7. Compile the code and save the form.

8. Now open the form in regular view and double-click that
control. The calendar should then appear.

I think I got all the steps correct.

Hope that helps,
Jeff Conrad
Access Junkie
Bend, Oregon

Pete Merenda said:
I've downloaded the Lebans calendar, but do not know how to "integrate" it
into my Db. I get by in Access by using Expression/Macro Builders, but I
know very little of VB programming.
My logic has been to: 1) copy the Lebans modules and fields to my Db, 2)
search the VB code for references to form and table names in the Lebans Db,
and 3) rename them. I continue to get "Ambiguous name" errors.
 
S

Stephen Lebans

Thank you for helping out Jeff. I get so many Email requests for support
every day that I do not always find the time to answer them here. I
think I'll take your post and place it on the MonthCalendar Web site if
that is OK with you.

Last night I posted a new version of MonthCalendar. There is a major
modification to the calling function logic including calling Parameter
order. Changed function to return Boolean FALSE and "StartSelectedDate
=0" if user did not select a date from the MonthCalendar. The hWndForm
param is no longer optional.

Here is the updated calling code to be placed behind the Click event of
a TextBox control named "txtDateMed".

Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date

dtStart = Nz(Me.txtDateMed.Value, 0)
dtEnd = 0

blRet = ShowMonthCalendar(mc, Me.hWnd, dtStart, dtEnd, , True)
If blRet = True Then
Me.txtDateMed = dtStart
Else
MsgBox "Hey - You forgot to select a Date!", vbOKOnly, "Did you
forget to select a date?"
End If


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
J

Jeff Conrad

Thank you for helping out Jeff. I get so many Email requests for support
every day that I do not always find the time to answer them here. I
think I'll take your post and place it on the MonthCalendar Web site if
that is OK with you.

<please excuse the following>
That's it, my life is now over and complete; my name will appear on Master
Leban's site!!!!
And people thought I'd never amount to anything.
HA!! I say!
<end silly dance around the desk/>

<begin serious side>
That would be just fine with me kind sir.
A thankful bow in your honor.
Last night I posted a new version of MonthCalendar.

Something new?!
Why did my Lebans Automatic Update Utility not notify me this morning?
Strange.
There is a major modification to the calling function logic including calling Parameter
order. Changed function to return Boolean FALSE and "StartSelectedDate
=0" if user did not select a date from the MonthCalendar. The hWndForm
param is no longer optional.

Here is the updated calling code to be placed behind the Click event of
a TextBox control named "txtDateMed".

Dim blRet As Boolean
Dim dtStart As Date, dtEnd As Date

dtStart = Nz(Me.txtDateMed.Value, 0)
dtEnd = 0

blRet = ShowMonthCalendar(mc, Me.hWnd, dtStart, dtEnd, , True)
If blRet = True Then
Me.txtDateMed = dtStart
Else
MsgBox "Hey - You forgot to select a Date!", vbOKOnly, "Did you
forget to select a date?"
End If

Well I know what I'll be doing tonight!
Have to check that out for sure.
Did you still leave in the coding for double-clicking a date instead of
single click?
Just curious.

Jeff Conrad
Access Junkie
Bend, Oregon
 
S

Stephen Lebans

I did not modify the logic for selecting dates.

When more than 10 people request a change to the functionality of any
project of mine I will take a look at the issue. In this case many
people felt, rightfully so, that the Calendar function should be able to
indicate when the user did not select a date. Honestly, I do not know
why I did not incorporate this functionality from the start.
:)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Jeff

Thanks for the suggestions but, I'm stumped on how to "compile" the Db. As a novice, I have to rely on the help files to educate myself of functions. Unfortunately, there's no clear direction on how to compile the Db. Does Access have a built-in compiler tool? Might Access refer to "compiling" by some other term -- referenceable in help files
 
J

Jeff Conrad

Hi Pete,

No problem.

Well I only have Access 97 at my present location today, but this is how it
is done in that version:
1. You need to get to any code window. You can do this by either opening any
form or module in Design View and click the button on the toolbar that says
"Code".
2. Then you go up to the toolbar and find the option that says: "Debug."
3. From that menu you select "Compile and Save All Modules."

What this does is go through ALL your code and look for any possible errors.
It will immediately stop on any problems it finds. Keep in mind that you may
have errors completely unrelated to Stephen's code. You will need to fix
those errors on your own.

You may run into a "References" problem with Stephen's code. If you receive
a message saying something like "Can't find project ot library" post back
and I'll help you through that.

For Access 2000, 2002, and 2003 I *think* (purely on memory here) you
compile by following these steps:
1. You need to get to any code window. You can do this by either opening any
form or module in Design View and click the button on the toolbar that says
"Code Window".
2. Then you go up to the toolbar and find the option that says: "Debug."
3. From that menu you select "Compile <name of your database>."

Hope that helps,
Jeff Conrad
Access Junkie
Bend, Oregon

Pete Merenda said:
Jeff,

Thanks for the suggestions but, I'm stumped on how to "compile" the Db.
As a novice, I have to rely on the help files to educate myself of
functions. Unfortunately, there's no clear direction on how to compile the
Db. Does Access have a built-in compiler tool? Might Access refer to
"compiling" by some other term -- referenceable in help files?
 
J

Jeff Conrad

Hi Sensei,
I did not modify the logic for selecting dates.

Cool!! Very slick!
I especially like how easily it is to change it!

Question: Is there a way I can manually change the code to not have the
capability to select a range of dates using your calendar? Or possibly just
turn it off if I'm ONLY selecting a single date for one control? Sort of a
control by control basis? Just curious.
When more than 10 people request a change to the functionality of any
project of mine I will take a look at the issue. In this case many
people felt, rightfully so, that the Calendar function should be able to
indicate when the user did not select a date. Honestly, I do not know
why I did not incorporate this functionality from the start.
:)

I actually thought of that, but it wasn't that big of a deal to me honestly.
However, now that it IS included, this is VERY sweet!!

May I add just a thought?
Getting back to the single click vs double click options.
I can see I would need to manually adjust the code for each procedure to
have the calendar only accept a double-click which is fine. Myself and my
users "grew up" with that option and we're used to using the calendar that
way. However, it would be nice to give some users, if they so desire, the
ability to single click.

We use a professional VB program for purchases/inventory at our locations.
On their main login page they have a check box for "Single-Click Interface."
I have always felt that was a great idea on their part to allow the user to
customize the way the application runs for them.

So would it be possible sometime to add one item to the Properties list that
says "Interface" with two options: Single-Click and Double-Click? The option
selected would apply globally throughout the application. That way no extra
coding would be required to adhere to someone's else's tastes and I wouldn't
have to instill my personal preference on other people?

Just a thought.
Jeff Conrad
Access Junkie
Bend, Oregon
 
J

Jeff Conrad

Hi Pete,

No problem, we all have to start somewhere.
.......except maybe Stephen.
I think he was born spitting out code like crazy.

Anyway, back to your problem.
Your machine may have a missing reference.
The arch-nemesis of Access is missing references.

Here's what you should try:

1. Open any module in Design view.
2. On the Tools menu, click References.
3. At least one Reference should say "Missing".
WRITE that down, most likely it will be the DAO library.
4. Click to clear the check box for the type library or object library
marked as "Missing:."
5. Close the References Window box.
6. Open it back up.
Hopefully, nothing should say Missing this time.
7. Now go find that library/project in the list.
If it it is the DAO one scroll down to you get to Microsoft DAO 3.xx and
check it.
If you're using Access 97 that should be DAO 3.51 I think.
If you're using Access 2000, 2002, or 2003 that should be DAO 3.6 I believe
8. If more than one were missing, find the others and check them as well.
9. Close the References box again.
10. Now re-compile again. Debug--Compile.
11. Hopefully you should not see any more compile errors.

Then you can begin setting up the form code to use the calendar.

If you'd like to read more about References, here's more info than you could
possibly ever want to know:

http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html

http://members.iinet.net.au/~allenbrowne/ser-38.html

http://www.trigeminal.com/usenet/usenet026.asp

ACC2002: References That You Must Set When You Work with Microsoft Access
http://support.microsoft.com/?id=283115

ACC97: References That You Must Set When You Work with Microsoft Access
http://support.microsoft.com/?id=175484

ACC: VBA Functions Break in Database with Missing References
http://support.microsoft.com/?id=160870

Hope that helps,
Jeff Conrad
Access Junkie
Bend, Oregon

Pete Merenda said:
Jeff,

First, I completely appreciate your help, as well as the tone of your
notes (not slamming me for lack of VB knowledge). When attempting to
compile the Lebans Calendar code, I get a "variable not defined" error
related to the term "dbLong" (per below which first appears within the
MultiSelect [Property Get] function. Any advice in citing a declaration to
define the term?
 
G

Guest

Jeff

If/when I ever sent a message saying "it's working", you knew I'd also say.."and it is awesome." Seems like I have a couple of final tweaks to format. When I use the window properties to format the calendar's appearance, the properties don't hold (and revert back to defaults when re-opening the Db). At this point, I don't want to tinker with the code only to start the process again. Am I able to go to the code and change default settings? Can you tell me where they're located within the code, and what to change?

Objectives are
Viewable months:
Week numbers: N
Show Today: Ye
Circle Today: Ye
Position: Center of Scree

Thanks again for all your help!!
 
J

Jeff Conrad

Hi Pete,

Well that is quite odd.
I tested the calendar with the settings you chose and everything held the
next time I double-clicked the field. I then closed the database, re-opened
it, and tried again. All the settings were the same as I had chosen earlier.

I think Stephen may have to help on this one.
Please mention what Access version you are using.

In the mean time I would try compacting the database and see if that helps.
I would NOT mess with any of Stephen's code!!
"Don't go down the path to the dark side Pete!"

Jeff


Pete Merenda said:
Jeff,

If/when I ever sent a message saying "it's working", you knew I'd also
say.."and it is awesome." Seems like I have a couple of final tweaks to
format. When I use the window properties to format the calendar's
appearance, the properties don't hold (and revert back to defaults when
re-opening the Db). At this point, I don't want to tinker with the code
only to start the process again. Am I able to go to the code and change
default settings? Can you tell me where they're located within the code,
and what to change??
 
S

Stephen Lebans

THere is no need for you to "tinker" with the code as it works as
advertised. The settings you specify for the Calendar are stored as
Custom Properties within the MDB. I have never seen a case of the props
not being saved to a standard MDB.
What version of Access are you using?


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Pete Merenda said:
Jeff,

If/when I ever sent a message saying "it's working", you knew I'd also
say.."and it is awesome." Seems like I have a couple of final tweaks to
format. When I use the window properties to format the calendar's
appearance, the properties don't hold (and revert back to defaults when
re-opening the Db). At this point, I don't want to tinker with the code
only to start the process again. Am I able to go to the code and change
default settings? Can you tell me where they're located within the
code, and what to change??
 
S

Stephen Lebans

Jeff to restrict the ability for the user to select a range of dates
either:

1) Set the MaxSelectRangeofDays property to "1"
or
2) Set the MultiSelect property to FALSE

Not sure I understand the One Click issue. YOu can either pass an
optional parameter to the SHowMOnthCalendar function or directly set the
OneClick class property before you call the function. Since the default
is to force a DoubleClick I really do not see an issue here.

Perhaps, what you mean is that the OneClick property should be persisted
in a Custom DB prop as the other props(viewable months etc.) are. That
would only be a few lines of code. Is this what you are looking for?
:)
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
J

Jeff Conrad

Hi Sensei!
Jeff to restrict the ability for the user to select a
range of dates either:

1) Set the MaxSelectRangeofDays property to "1"

Searching......OK got it.
Well that was easy!
2) Set the MultiSelect property to FALSE

Thought I'd try this as well.
Gotcha. Works there as well. Nice!
Not sure I understand the One Click issue. You can either
pass an optional parameter to the SHowMOnthCalendar
function or directly set the OneClick class property
before you call the function. Since the default
is to force a DoubleClick I really do not see an issue
here.

No issue there, but you hit the nail on the head here:
Perhaps, what you mean is that the OneClick property
should be persisted in a Custom DB prop as the other props
(viewable months etc.) are. That would only be a few lines
of code. Is this what you are looking for?
:)

Exactly!!!
In the Properties list it would be just one more option.
It could be named something like "Click Interface." That
would lead to two options on the right side of it: Single
Click and Double Click (or something similar).

I prefer the double click myself so I set the properties
to my liking and use the program. Next user prefers to
single click after me so they go into the Properties list
and select Single Click. Boom! Instantly the calendar will
accept single click throughout the database. No manual
changing of the calling code for the developer at all!
Does that make sense?

Just a thought, but I think it would be a cool addition.

Jeff Conrad
Access Junkie
Bend, Oregon
 
S

Stephen Lebans

I agree Jeff and will add it to the next release.

In the mean time you can easily achieve the desired interface with the
existing MonthCalendar class. Even though the MonthCalendar window is
created and destroyed each time it is called the MonthCalendar class
itself remains during the lifetime of the form. If you popped an input
box form and asked the user which "click interface" they desired, then
set the OneClick prop to their selection, their choice would remain
active for the rest of that session.
:)

--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
J

Jeff Conrad

Hi Sensei,
I agree Jeff and will add it to the next release.

Really?!
That would be SWEET!
I wait with great anticipation!
In the mean time you can easily achieve the desired
interface with the existing MonthCalendar class. Even
though the MonthCalendar window is created and destroyed
each time it is called the MonthCalendar class
itself remains during the lifetime of the form.

Just one form correct? Not one database file?
So if I opened another form in the same DB the property
would not hold since the window is destroyed in the form's
unload event, correct?
If you popped an input box form and asked the user
which "click interface" they desired, then set the
OneClick prop to their selection, their choice would
remain active for the rest of that session.
:)

Humm...I'll have to play with that for fun and see if I
can get that to work.

Thanks again,
Jeff Conrad
Access Junkie
Bend, Oregon
 
J

John Vinson

Thanks for the suggestions but, I'm stumped on how to "compile" the Db.

Type Ctrl-G to open the VBA editor; on the menu there's a "Debug"
selection. Select it; the first line on the menu is Compile <your
database>. If it's greyed out your database is already compiled; if
not, click it.
 

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

Top