Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MonthView Control - Detecting Next/Prev Button Clicks

Status
Not open for further replies.

ktwclark

Programmer
Jan 30, 2002
54
0
0
GB
Hi

I'm using the MonthView ActiveX control in Access to select a range of dates from 2 consecutive months. I'm displaying 2 months using the control. If I select a range of dates and then press the next or previous buttons that come with the control the next months shift place by 1 month but the selected range remains the same except it has moved on a mont too! I thought the selstart and selend used dates but it must use an offset from the first visible date. So when the months change, the selected range of dates is still the same, if that makes sense.

I've been looking the event that is triggered when you click either the next or previous buttons on the MonthView control but to no avail.

Any help would be appreciated.
 

ktwclark, have you read FAQ222-2244 yet? Perhaps you should check out items 16 and 16.

Use the mouse down event and capture the X and Y of the control. Then do some calculations with the X and Y to see if it was either of the buttons that was clicked.

Good Luck and good Reading of FAQ222-2244

 
Thanks for the tips. Don't quite understand reading point 16 about a two way forum. I've answered a few questions on the forum.

Anyway, if I use the X and Y co-ords do I not have to take into account screen resolutions, if the form containing the control has been moved, i.e the x and y co-ords could change depending on a lot of different situations.

I read something about the HitTest method for the control where you could return the mvwTitlebtnNext and mvwTitleBtnPrev but I didn't manage to code this successfully.

Do you have a code example?

Thanks in advance.
 
Found the answer:

I have a monthview control called mtvCalendar on a form in access and this code.

Private Sub mtvCalendar_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long)
Dim iResult As Integer
Dim dtMyDate As Date
iResult = mtvCalendar.HitTest(x, y, dtMyDate)
MsgBox dtMyDate, vbOKOnly
End Sub

I've actually used the _MouseUp event as I'm looking for either of the next or previous month buttons being clicked.

Got there in the end!

K
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top