Help with double click event

Help with double click event

am 09.11.2007 13:16:12 von Keith Tizzard

I have an unbound form that displays all the days of the year as a
calendar. It has 12 rows of text boxes with either 29,30 or 31 in
each row. Text box names are of the form: display_01_01,
display_01_02 ... display_12_31.

This is used to display bookings of holiday properties and works
well. I am now wishing to be able to highlight a range of dates by
double clicking in one text box and then in another, highlighting all
the dates between these.

I am creating a double click event for each of the 366 text boxes,
although the body of each is identical in that it calls Sub which does
the work.

I am, at the moment, steadily and painstakingly creating these events.

What I am wondering is whether is a better way. Could I use the double
click event of the Form or Detail. I.e. if a text box does not have a
double click event is the click passed on to the Form?

Any ideas would be welcome. It is working for January, Februay and
March bu I still I have more than 200 events to create!!

Jim

Re: Help with double click event

am 09.11.2007 13:52:22 von Tom van Stiphout

On Fri, 09 Nov 2007 04:16:12 -0800, Jim Devenish
wrote:

No. Events don't bubble up in VBA, unlike in DotNet.

You could generate the events in code. Check out the Module object,
its CreateEventProc method, etc.

-Tom.


>I have an unbound form that displays all the days of the year as a
>calendar. It has 12 rows of text boxes with either 29,30 or 31 in
>each row. Text box names are of the form: display_01_01,
>display_01_02 ... display_12_31.
>
>This is used to display bookings of holiday properties and works
>well. I am now wishing to be able to highlight a range of dates by
>double clicking in one text box and then in another, highlighting all
>the dates between these.
>
>I am creating a double click event for each of the 366 text boxes,
>although the body of each is identical in that it calls Sub which does
>the work.
>
>I am, at the moment, steadily and painstakingly creating these events.
>
>What I am wondering is whether is a better way. Could I use the double
>click event of the Form or Detail. I.e. if a text box does not have a
>double click event is the click passed on to the Form?
>
>Any ideas would be welcome. It is working for January, Februay and
>March bu I still I have more than 200 events to create!!
>
>Jim

Re: Help with double click event

am 09.11.2007 16:21:38 von OldPro

On Nov 9, 6:16 am, Jim Devenish wrote:
> I have an unbound form that displays all the days of the year as a
> calendar. It has 12 rows of text boxes with either 29,30 or 31 in
> each row. Text box names are of the form: display_01_01,
> display_01_02 ... display_12_31.
>
> This is used to display bookings of holiday properties and works
> well. I am now wishing to be able to highlight a range of dates by
> double clicking in one text box and then in another, highlighting all
> the dates between these.
>
> I am creating a double click event for each of the 366 text boxes,
> although the body of each is identical in that it calls Sub which does
> the work.
>
> I am, at the moment, steadily and painstakingly creating these events.
>
> What I am wondering is whether is a better way. Could I use the double
> click event of the Form or Detail. I.e. if a text box does not have a
> double click event is the click passed on to the Form?
>
> Any ideas would be welcome. It is working for January, Februay and
> March bu I still I have more than 200 events to create!!
>
> Jim

It's been more than 20 minutes... my first response must be lost in
the either. You don't have to open a code window for each textbox,
just create a common function that uses the textbox number, or the
date as a parameter, and add the function to each doubleclick proptery
in each of the property windows. It would look something like this:
= HiliteDates(1)
The 1 represents the number of the textbox that was clicked. If you
put
me("textbox" & num).Value
in the function, then you can get the date. If you use the Static
keyword, you can check the last date before reading the new date, and
thus know which range to hilite.

Re: Help with double click event

am 09.11.2007 16:42:59 von Keith Tizzard

On Nov 9, 3:21 pm, OldPro wrote:
> On Nov 9, 6:16 am, Jim Devenish wrote:
>
>
>
> > I have an unbound form that displays all the days of the year as a
> > calendar. It has 12 rows of text boxes with either 29,30 or 31 in
> > each row. Text box names are of the form: display_01_01,
> > display_01_02 ... display_12_31.
>
> > This is used to display bookings of holiday properties and works
> > well. I am now wishing to be able to highlight a range of dates by
> > double clicking in one text box and then in another, highlighting all
> > the dates between these.
>
> > I am creating a double click event for each of the 366 text boxes,
> > although the body of each is identical in that it calls Sub which does
> > the work.
>
> > I am, at the moment, steadily and painstakingly creating these events.
>
> > What I am wondering is whether is a better way. Could I use the double
> > click event of the Form or Detail. I.e. if a text box does not have a
> > double click event is the click passed on to the Form?
>
> > Any ideas would be welcome. It is working for January, Februay and
> > March bu I still I have more than 200 events to create!!
>
> > Jim
>
> It's been more than 20 minutes... my first response must be lost in
> the either. You don't have to open a code window for each textbox,
> just create a common function that uses the textbox number, or the
> date as a parameter, and add the function to each doubleclick proptery
> in each of the property windows. It would look something like this:
> = HiliteDates(1)
> The 1 represents the number of the textbox that was clicked. If you
> put
> me("textbox" & num).Value
> in the function, then you can get the date. If you use the Static
> keyword, you can check the last date before reading the new date, and
> thus know which range to hilite.

Great. I had forgotten (if I every realised) that I could put a
function name directly in the properties against On Dbl Click.

The really quick thing is that I can select all the text boxes in one
go and enter the function name just one. Brilliant.

Jim

Re: Help with double click event

am 09.11.2007 16:54:39 von Keith Tizzard

On Nov 9, 3:42 pm, Jim Devenish wrote:
> On Nov 9, 3:21 pm, OldPro wrote:
>
>
>
> > On Nov 9, 6:16 am, Jim Devenish wrote:
>
> > > I have an unbound form that displays all the days of the year as a
> > > calendar. It has 12 rows of text boxes with either 29,30 or 31 in
> > > each row. Text box names are of the form: display_01_01,
> > > display_01_02 ... display_12_31.
>
> > > This is used to display bookings of holiday properties and works
> > > well. I am now wishing to be able to highlight a range of dates by
> > > double clicking in one text box and then in another, highlighting all
> > > the dates between these.
>
> > > I am creating a double click event for each of the 366 text boxes,
> > > although the body of each is identical in that it calls Sub which does
> > > the work.
>
> > > I am, at the moment, steadily and painstakingly creating these events.
>
> > > What I am wondering is whether is a better way. Could I use the double
> > > click event of the Form or Detail. I.e. if a text box does not have a
> > > double click event is the click passed on to the Form?
>
> > > Any ideas would be welcome. It is working for January, Februay and
> > > March bu I still I have more than 200 events to create!!
>
> > > Jim
>
> > It's been more than 20 minutes... my first response must be lost in
> > the either. You don't have to open a code window for each textbox,
> > just create a common function that uses the textbox number, or the
> > date as a parameter, and add the function to each doubleclick proptery
> > in each of the property windows. It would look something like this:
> > = HiliteDates(1)
> > The 1 represents the number of the textbox that was clicked. If you
> > put
> > me("textbox" & num).Value
> > in the function, then you can get the date. If you use the Static
> > keyword, you can check the last date before reading the new date, and
> > thus know which range to hilite.
>
> Great. I had forgotten (if I every realised) that I could put a
> function name directly in the properties against On Dbl Click.
>
> The really quick thing is that I can select all the text boxes in one
> go and enter the function name just one. Brilliant.
>
> Jim

As I say in my previous post, it works well. However I have notice
one oddity. When I double click the text box, the function is
entered on 3 consecutive times whereas the double click event code was
entered only once.

Strange. Not sure why this happens.

Any idea?

Jim

Re: Help with double click event

am 09.11.2007 17:41:34 von OldPro

On Nov 9, 9:54 am, Jim Devenish wrote:
> On Nov 9, 3:42 pm, Jim Devenish wrote:
>
>
>
>
>
> > On Nov 9, 3:21 pm, OldPro wrote:
>
> > > On Nov 9, 6:16 am, Jim Devenish wrote:
>
> > > > I have an unbound form that displays all the days of the year as a
> > > > calendar. It has 12 rows of text boxes with either 29,30 or 31 in
> > > > each row. Text box names are of the form: display_01_01,
> > > > display_01_02 ... display_12_31.
>
> > > > This is used to display bookings of holiday properties and works
> > > > well. I am now wishing to be able to highlight a range of dates by
> > > > double clicking in one text box and then in another, highlighting all
> > > > the dates between these.
>
> > > > I am creating a double click event for each of the 366 text boxes,
> > > > although the body of each is identical in that it calls Sub which does
> > > > the work.
>
> > > > I am, at the moment, steadily and painstakingly creating these events.
>
> > > > What I am wondering is whether is a better way. Could I use the double
> > > > click event of the Form or Detail. I.e. if a text box does not have a
> > > > double click event is the click passed on to the Form?
>
> > > > Any ideas would be welcome. It is working for January, Februay and
> > > > March bu I still I have more than 200 events to create!!
>
> > > > Jim
>
> > > It's been more than 20 minutes... my first response must be lost in
> > > the either. You don't have to open a code window for each textbox,
> > > just create a common function that uses the textbox number, or the
> > > date as a parameter, and add the function to each doubleclick proptery
> > > in each of the property windows. It would look something like this:
> > > = HiliteDates(1)
> > > The 1 represents the number of the textbox that was clicked. If you
> > > put
> > > me("textbox" & num).Value
> > > in the function, then you can get the date. If you use the Static
> > > keyword, you can check the last date before reading the new date, and
> > > thus know which range to hilite.
>
> > Great. I had forgotten (if I every realised) that I could put a
> > function name directly in the properties against On Dbl Click.
>
> > The really quick thing is that I can select all the text boxes in one
> > go and enter the function name just one. Brilliant.
>
> > Jim
>
> As I say in my previous post, it works well. However I have notice
> one oddity. When I double click the text box, the function is
> entered on 3 consecutive times whereas the double click event code was
> entered only once.
>
> Strange. Not sure why this happens.
>
> Any idea?
>
> Jim- Hide quoted text -
>
> - Show quoted text -

I tested it on my Access 97 version... it worked fine. Create a new
form and drop a single textbox on it. Put a function in the
double_click event property, and put a static counter in the function
with a msgbox that displays the counter. This is a quick and easy
test.

The only other thing that comes to mind is that you are working in a
continuous form. They have differenct rules, as there is only one
real set of controls; the rest are just reflections.

Re: Help with double click event

am 12.11.2007 23:38:11 von OldPro

On Nov 9, 6:16 am, Jim Devenish wrote:
> I have an unbound form that displays all the days of the year as a
> calendar. It has 12 rows of text boxes with either 29,30 or 31 in
> each row. Text box names are of the form: display_01_01,
> display_01_02 ... display_12_31.
>
> This is used to display bookings of holiday properties and works
> well. I am now wishing to be able to highlight a range of dates by
> double clicking in one text box and then in another, highlighting all
> the dates between these.
>
> I am creating a double click event for each of the 366 text boxes,
> although the body of each is identical in that it calls Sub which does
> the work.
>
> I am, at the moment, steadily and painstakingly creating these events.
>
> What I am wondering is whether is a better way. Could I use the double
> click event of the Form or Detail. I.e. if a text box does not have a
> double click event is the click passed on to the Form?
>
> Any ideas would be welcome. It is working for January, Februay and
> March bu I still I have more than 200 events to create!!
>
> Jim

That is the hard way! Just create a function that takes the date as a
parameter. Put the function right in the properities dialog for each
textbox like this =HiliteDate(dSelectedDate). There is no need to
actually open a code window. If you are willing to use the default
name of the textbox, you can go to a blank form, and copy the first
textbox, add the double click event, and then copy it 365 times. Then
just copy them all over to the actual form that you want to use.

By the way, standard convention is to hold the shift key while
selecting multiple adjoining items, not double-clicking. I always try
that first.