By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,588 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,588 IT Pros & Developers. It's quick & easy.

Help with double click event

P: n/a
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

Nov 9 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Nov 9, 6:16 am, Jim Devenish <internet.shopp...@foobox.comwrote:
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.

Nov 9 '07 #2

P: n/a
On Nov 9, 3:21 pm, OldPro <rrossk...@sbcglobal.netwrote:
On Nov 9, 6:16 am, Jim Devenish <internet.shopp...@foobox.comwrote:
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
Nov 9 '07 #3

P: n/a
On Nov 9, 3:42 pm, Jim Devenish <internet.shopp...@foobox.comwrote:
On Nov 9, 3:21 pm, OldPro <rrossk...@sbcglobal.netwrote:
On Nov 9, 6:16 am, Jim Devenish <internet.shopp...@foobox.comwrote:
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
Nov 9 '07 #4

P: n/a
On Nov 9, 9:54 am, Jim Devenish <internet.shopp...@foobox.comwrote:
On Nov 9, 3:42 pm, Jim Devenish <internet.shopp...@foobox.comwrote:


On Nov 9, 3:21 pm, OldPro <rrossk...@sbcglobal.netwrote:
On Nov 9, 6:16 am, Jim Devenish <internet.shopp...@foobox.comwrote:
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.

Nov 9 '07 #5

P: n/a
On Fri, 09 Nov 2007 04:16:12 -0800, Jim Devenish
<in***************@foobox.comwrote:

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
Nov 9 '07 #6

P: n/a
On Nov 9, 6:16 am, Jim Devenish <internet.shopp...@foobox.comwrote:
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.

Nov 12 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.