Allen Browne Calender Question2

R

randria

Hi, I m using Allen Browne's calendar and it is excellent. Now I want to know
how to use it using codes instead of On Click = CalendarFor([Ctrl]," txt").

this is what I tried
Private Sub SDate_DblClick(Cancel As Integer)
On Error GoTo Err_SDate_Dblclick
Dim prcd As SDate
Dim frmcalendar As Form ' I m not sure if this should be like this.
If Not IsNull(Me.sDate) Then
prcd = Me.Date
DoCmd.GoToRecord , , acNewRec
Me.Date = prcd
Else
If IsNull(Me.Date) Then
frmcalendar = CalendarFor([Sdate],"Set SDate") ' getting error calendarFor
not defined
DoCmd.OpenForm frmcalendar, acNormal
End If
End If
Exit_SDate_DblClick:
Exit Sub
Err_SDate_DblClick:
MsgBox Err.Description
Resume Exit_SDate_DblClick
End Sub

many thanks/
 
W

Wayne-I-M

Of course you could ?

But much simpler idea imbed the calender on your form (visable = no) then

If IsNull(Me.Date) Then
me.XXXX.visible=true

Use the after update of the calender to set focus to something else then

visible = false

Just an idea
 
R

randria

Hello Wayne, thanks for the idea, I tried it and it works , however, I did
really like seeing the command button appearing on each record ( It is a
subform ) so I did try the following codes but nothing happens so I know
something is wrong but I dont know.

Private Sub SDate_DblClick(Cancel As Integer)

On Error GoTo Err_SDate_DblClick
Dim prcd As Date
Dim frmCal As Form_frmCalendar
If Me.SDate <> 0 Then
prcd = Me.SDate
DoCmd.GoToRecord , , acNewRec
Me.SDate = prcd
Else
If Me.SDate = 0 Then
frmCal = CalendarFor([SDate], "Set Sdate")
DoCmd.OpenForm frmCal, acNormal

Exit_SDate_DblClick:
Exit Sub
Err_SDate_DblClick:
MsgBox Err.Description
Resume Exit_SDate_DblClick
End If
End If
End Sub

Thank you in advance


Wayne-I-M said:
Of course you could ?

But much simpler idea imbed the calender on your form (visable = no) then

If IsNull(Me.Date) Then
me.XXXX.visible=true

Use the after update of the calender to set focus to something else then

visible = false

Just an idea

--
Wayne
Trentino, Italia.



randria said:
Hi, I m using Allen Browne's calendar and it is excellent. Now I want to know
how to use it using codes instead of On Click = CalendarFor([Ctrl]," txt").

this is what I tried
Private Sub SDate_DblClick(Cancel As Integer)
On Error GoTo Err_SDate_Dblclick
Dim prcd As SDate
Dim frmcalendar As Form ' I m not sure if this should be like this.
If Not IsNull(Me.sDate) Then
prcd = Me.Date
DoCmd.GoToRecord , , acNewRec
Me.Date = prcd
Else
If IsNull(Me.Date) Then
frmcalendar = CalendarFor([Sdate],"Set SDate") ' getting error calendarFor
not defined
DoCmd.OpenForm frmcalendar, acNormal
End If
End If
Exit_SDate_DblClick:
Exit Sub
Err_SDate_DblClick:
MsgBox Err.Description
Resume Exit_SDate_DblClick
End Sub

many thanks/
 

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