Converting Popup calendar from AC 97 to Ac 95. Code problem

Ariid

New member
Local time
Today, 23:29
Joined
Oct 18, 2005
Messages
3
Hi all,
I'm quite new to Access. My problem is that I am developing a database for myself at work. They use access 95. I don't have access to that at home so use Ac 97 and use downsizer to convert it to Ac 95. Everything works fine (with some tweaking) except the popup calendar (I used allen browne's). Access 95 doesn't like some aspects of the code, specifically ;

Public Function CalendarFor(txt As TextBox, Optional strTitle As String)
this code is in the module, and i get an error optional argument must be variant. if i 'fix*' this i get an error on the form when i try to open the calendar (The expression on click you entered as the event property setting produced an error: Type Mismatch) except for 1 textbox on which it works fine.
And;

Private Function SetDate(Unit As String, Optional intStep As integer = 1)
I get an error when compiling-Expected: List seperator or) is this a syntax problem?

*By fix I mean replacing the code with
Public Function CalendarFor(txt As TextBox, Optional strTitle As Variant)
and
Private Function SetDate(Unit As String, Optional intStep As integer)

I need to know whether Iam on a hiding into nothing trying to get this to work on AC 95 or if it will work, can someone point me in the right direction.

Cheers in advance.


Ps the original full code is;

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
And
Private Function SelectDate(ctlName As String)
Call SetSelected(ctlName)
Call cmdOk_Click
End Function

Private Function SetDate(Unit As String, Optional intStep As Integer = 1)
On Error GoTo Err_Handler

Me.txtDate = DateAdd(Unit, intStep, Me.txtDate)
Call ShowCal

Exit_Handler:
Exit Function

Err_Handler:
MsgBox "Error " & Err.Number & " - " & Err.Description, vbExclamation, conMod & ".SetDate"
Resume Exit_Handler
End Function
 
Why not start [design] with Access 95 at work and then convert the db when you get home to Access 97? Working with more than one version can get very messy as you have discovered.

How about trying another calander?

Check out these custom Access calanders for you can import them right into your database...

Popup Calendar - Version 3

I prefer the authors first calendar because I do not want the fancy three months options. Here is the link to that one... Popup Calendar

You have to be a member to download the samples but membership is free and worth every penny.
 

Users who are viewing this thread

Back
Top Bottom