Topic:access calendar control Remainpoint:0
   
PostTime:12/16/2008 3:33:45 PM FloorTop
Lv is 1
Avatar
Level:
1
Professional point:
17
Experience:
7
Thread:
282
Post:
954
Total online time:
7M
Joined date:
4/28/2007 11:52:00 PM
Last Visit:
12/17/2008 12:05:13 AM
Status:
Offline
I have several forms that have undound fields which are apopulated via a calendar on access (ocxcalendar)

One of the forms works and then if a modification is done on the form code (even if the change is not related to the ocxcalendar) the feature stops working and the fields are not populated by the calendar.

This has only 3 routines (all the forms that use the calendar have the same 3 routines), one for the ocxcalendar_click and then the start and end dates have each one routine triggered by the on mouse down event.

Any ideas?

 
     
   
Gender PostTime:12/16/2008 5:50:14 PM Point:0 | Floor# 1
Lv is 1
portrait
Level:
1
Professional point:
46
Experience:
6
Thread:
265
Post:
966
Total online time:
6M
Joined date:
4/29/2007 12:00:00 AM
Last Visit:
12/17/2008 12:21:04 AM
Status:
Offline
Here is the code.

Option Compare Database
Option Explicit
Dim DateOriginator As ComboBox

Private Sub ocxCalendar_Click()

' the following line is the one that does not work. It does not assign a value to the date, so
' the calendar has the system date value, or null, and passes it to the unbound field on the
'form

DateOriginator.Value = ocxCalendar.Value
DateOriginator.SetFocus
ocxCalendar.Visible = False
Set DateOriginator = Nothing
End Sub


' The respective value for each date (start and end) should come to populate
'the fields below

Private Sub StartDate_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Set DateOriginator = StartDate
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(DateOriginator) Then
ocxCalendar.Value = DateOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub

Private Sub EndDate_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Set DateOriginator = EndDate
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(DateOriginator) Then
ocxCalendar.Value = DateOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub


thanks again,

Hector
 
     
   
Gender PostTime:12/16/2008 9:34:10 PM Point:0 | Floor# 2
Lv is 1
portrait
Level:
1
Professional point:
2
Experience:
12
Thread:
278
Post:
932
Total online time:
12M
Joined date:
4/28/2007 11:48:00 PM
Last Visit:
12/16/2008 11:40:44 PM
Status:
Online
First of all, have you stepped through the code to check the values of these things that are apparently returning Nulls?

Are StartDate and EndDate controls on the ActiveX calendar control or are they standard controls on your form? Is there a reason you're using the MouseDown event rather than the Click event?

chris.
 
     
   
Gender PostTime:12/16/2008 11:11:54 PM Point:0 | Floor# 3
Lv is 1
portrait
Level:
1
Professional point:
94
Experience:
1
Thread:
261
Post:
990
Total online time:
1M
Joined date:
4/28/2007 11:41:00 PM
Last Visit:
12/17/2008 12:44:11 AM
Status:
Online
Eh, I avoid ActiveX like the plague. So I don't really know what to say. There is a free class-module calendar control at MDBMakers.com. If you don't feel like a redesign, could you provide the code please for the entire form?

chris.
 
     
   
Gender PostTime:12/16/2008 11:24:45 PM Point:0 | Floor# 4
Lv is 1
portrait
Level:
1
Professional point:
64
Experience:
3
Thread:
277
Post:
897
Total online time:
3M
Joined date:
4/28/2007 11:25:00 PM
Last Visit:
12/16/2008 11:33:11 PM
Status:
Offline
StartDate and EndDate are controls on the form. They are both unbound fields that have the looks of combo boxes, being this the reason why I use onMouseDown instead of the usual Click event to trigger the code. It was done like that on a bucnh of forms before, so I copied the code and the fields and calendar into a new form.

The value from the active calendar is the ocxCalendar, which should return a date for StartDate and for EndDate, if there is a selection from the calendar. Otherwise it will take the defaults (date-15 for start and date for end).

I'll be happy to find an answer to this, because it does not make sense that it works perfectly on other applications and on this one it does it sporadically.
 
     
1

Sorry, you are not login, click here to login

 

About us | Advertise | Contact us | Partner | Bug Report|Suggesting box|Donation
Home | Forum | Affiliate program| Remote help | Setting | Search | Document | Help | Download|Message

 

Start new topicAdvanced search
Your location: Database -> Access