PC Review


Reply
Thread Tools Rate Thread

different dates from one calendar

 
 
=?Utf-8?B?RGF2aWQgTWFjZG9uYWxk?=
Guest
Posts: n/a
 
      21st Nov 2006
I've got my form with TextBoxes and I've got my calendar.
I've even got the thing loading all the necessary fields into the right
cells in a new correctly formatted row on my worksheet.
All of this thanks to posts I found here - I've learnt so much in the last 2
weeks!

Three of the textboxes on this form need to take dates. How can I tell the
Calendar which of the three to send the data to ?
My solution:
Three separate calendars (and CommandButtons to send the Value) that only
become visible when the cursor enters the relative textbox. i.e. Calendar1
appears when entering TextBox1 then disappears after its button is clicked,
Calendar2 appears later on when entering TextBox2 etc. I could place them all
in the same position so to the user it'd look like the same calendar
appearing each time. I certainly don't want three calendars filling my form!

Is there a more direct way ? Some property of textBoxes like "HasFocus" or
"IsActive" that I could use ?
 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      22nd Nov 2006
David,
The userform has an ActiveControl property, but in your case, this would be
the calendar not the text box.
You could give yourself a private object the track the destination textbox,
setting it when each tb is entered. Then the calendar (I've used a listbox
here, but the same applies) sends it's value to that tb:

Dim mtb As msforms.TextBox

Private Sub ListBox1_Click()
mtb.Value = ListBox1.Value
End Sub

Private Sub TextBox1_Enter()
Set mtb = TextBox1
End Sub

Private Sub TextBox2_Enter()
Set mtb = TextBox2
End Sub

NickHK

"David Macdonald" <(E-Mail Removed)> wrote in
message news:3AF78A38-A698-4C63-9C7E-(E-Mail Removed)...
> I've got my form with TextBoxes and I've got my calendar.
> I've even got the thing loading all the necessary fields into the right
> cells in a new correctly formatted row on my worksheet.
> All of this thanks to posts I found here - I've learnt so much in the last

2
> weeks!
>
> Three of the textboxes on this form need to take dates. How can I tell the
> Calendar which of the three to send the data to ?
> My solution:
> Three separate calendars (and CommandButtons to send the Value) that only
> become visible when the cursor enters the relative textbox. i.e. Calendar1
> appears when entering TextBox1 then disappears after its button is

clicked,
> Calendar2 appears later on when entering TextBox2 etc. I could place them

all
> in the same position so to the user it'd look like the same calendar
> appearing each time. I certainly don't want three calendars filling my

form!
>
> Is there a more direct way ? Some property of textBoxes like "HasFocus" or
> "IsActive" that I could use ?



 
Reply With Quote
 
=?Utf-8?B?RGF2aWQgTWFjZG9uYWxk?=
Guest
Posts: n/a
 
      22nd Nov 2006
Nick,
A million thanks! This also gets rid of the button too.
There was only one advantage I could see to my method - after putting the
date into the right textbox the cursor would go to the next field (as set up
in tab order) but now it always goes to the beginning of the form. There's
something for me to work on this morning...


"NickHK" wrote:

> David,
> The userform has an ActiveControl property, but in your case, this would be
> the calendar not the text box.
> You could give yourself a private object the track the destination textbox,
> setting it when each tb is entered. Then the calendar (I've used a listbox
> here, but the same applies) sends it's value to that tb:
>
> Dim mtb As msforms.TextBox
>
> Private Sub ListBox1_Click()
> mtb.Value = ListBox1.Value
> End Sub
>
> Private Sub TextBox1_Enter()
> Set mtb = TextBox1
> End Sub
>
> Private Sub TextBox2_Enter()
> Set mtb = TextBox2
> End Sub
>
> NickHK
>
> "David Macdonald" <(E-Mail Removed)> wrote in
> message news:3AF78A38-A698-4C63-9C7E-(E-Mail Removed)...
> > I've got my form with TextBoxes and I've got my calendar.
> > I've even got the thing loading all the necessary fields into the right
> > cells in a new correctly formatted row on my worksheet.
> > All of this thanks to posts I found here - I've learnt so much in the last

> 2
> > weeks!
> >
> > Three of the textboxes on this form need to take dates. How can I tell the
> > Calendar which of the three to send the data to ?
> > My solution:
> > Three separate calendars (and CommandButtons to send the Value) that only
> > become visible when the cursor enters the relative textbox. i.e. Calendar1
> > appears when entering TextBox1 then disappears after its button is

> clicked,
> > Calendar2 appears later on when entering TextBox2 etc. I could place them

> all
> > in the same position so to the user it'd look like the same calendar
> > appearing each time. I certainly don't want three calendars filling my

> form!
> >
> > Is there a more direct way ? Some property of textBoxes like "HasFocus" or
> > "IsActive" that I could use ?

>
>
>

 
Reply With Quote
 
NickHK
Guest
Posts: n/a
 
      22nd Nov 2006
David,
Not sure what you mean by "it always goes to the beginning of the form"...
But you could have another private variable to indicate the next textbox
that should have the focus.
Or save the name of the next textbox in the current textbox's .tag property,
then

Private Sub ListBox1_Click()
With mtb
.Value = ListBox1.Value
Me.Controls(.Tag).SetFocus
End with
End Sub


(Unfortunately VBA does not support Control arrays, which would tasks like
this more simple.)

NickHK

"David Macdonald" <(E-Mail Removed)> wrote in
message news:0385F39A-A117-44DB-A874-(E-Mail Removed)...
> Nick,
> A million thanks! This also gets rid of the button too.
> There was only one advantage I could see to my method - after putting the
> date into the right textbox the cursor would go to the next field (as set

up
> in tab order) but now it always goes to the beginning of the form. There's
> something for me to work on this morning...
>
>
> "NickHK" wrote:
>
> > David,
> > The userform has an ActiveControl property, but in your case, this would

be
> > the calendar not the text box.
> > You could give yourself a private object the track the destination

textbox,
> > setting it when each tb is entered. Then the calendar (I've used a

listbox
> > here, but the same applies) sends it's value to that tb:
> >
> > Dim mtb As msforms.TextBox
> >
> > Private Sub ListBox1_Click()
> > mtb.Value = ListBox1.Value
> > End Sub
> >
> > Private Sub TextBox1_Enter()
> > Set mtb = TextBox1
> > End Sub
> >
> > Private Sub TextBox2_Enter()
> > Set mtb = TextBox2
> > End Sub
> >
> > NickHK
> >
> > "David Macdonald" <(E-Mail Removed)> wrote in
> > message news:3AF78A38-A698-4C63-9C7E-(E-Mail Removed)...
> > > I've got my form with TextBoxes and I've got my calendar.
> > > I've even got the thing loading all the necessary fields into the

right
> > > cells in a new correctly formatted row on my worksheet.
> > > All of this thanks to posts I found here - I've learnt so much in the

last
> > 2
> > > weeks!
> > >
> > > Three of the textboxes on this form need to take dates. How can I tell

the
> > > Calendar which of the three to send the data to ?
> > > My solution:
> > > Three separate calendars (and CommandButtons to send the Value) that

only
> > > become visible when the cursor enters the relative textbox. i.e.

Calendar1
> > > appears when entering TextBox1 then disappears after its button is

> > clicked,
> > > Calendar2 appears later on when entering TextBox2 etc. I could place

them
> > all
> > > in the same position so to the user it'd look like the same calendar
> > > appearing each time. I certainly don't want three calendars filling my

> > form!
> > >
> > > Is there a more direct way ? Some property of textBoxes like

"HasFocus" or
> > > "IsActive" that I could use ?

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?RGF2aWQgTWFjZG9uYWxk?=
Guest
Posts: n/a
 
      22nd Nov 2006
The calendar had ended up at the bottom of the tab list when I renamed it.
Now I have it just after the first textbox so once the date has been sent the
cursor goes to the next control. The problem is caused by there being more
controls than just the three textboxes where I need to input dates, and these
other controls come between one box of dates (xmas round the corner) and the
next.
So after getting to the second textbox and clicking the calendar, the date
is correctly input but the cursor returns to the same place as before (right
after textbox1) - it's following the tab order and one control can't be in
two positions in the tab list of course.
I figured it must be something with setfocus and probably an if/else
condition...


"NickHK" wrote:

> David,
> Not sure what you mean by "it always goes to the beginning of the form"...
> But you could have another private variable to indicate the next textbox
> that should have the focus.
> Or save the name of the next textbox in the current textbox's .tag property,
> then
>
> Private Sub ListBox1_Click()
> With mtb
> .Value = ListBox1.Value
> Me.Controls(.Tag).SetFocus
> End with
> End Sub
>
>
> (Unfortunately VBA does not support Control arrays, which would tasks like
> this more simple.)
>
> NickHK
>
> "David Macdonald" <(E-Mail Removed)> wrote in
> message news:0385F39A-A117-44DB-A874-(E-Mail Removed)...
> > Nick,
> > A million thanks! This also gets rid of the button too.
> > There was only one advantage I could see to my method - after putting the
> > date into the right textbox the cursor would go to the next field (as set

> up
> > in tab order) but now it always goes to the beginning of the form. There's
> > something for me to work on this morning...
> >
> >
> > "NickHK" wrote:
> >
> > > David,
> > > The userform has an ActiveControl property, but in your case, this would

> be
> > > the calendar not the text box.
> > > You could give yourself a private object the track the destination

> textbox,
> > > setting it when each tb is entered. Then the calendar (I've used a

> listbox
> > > here, but the same applies) sends it's value to that tb:
> > >
> > > Dim mtb As msforms.TextBox
> > >
> > > Private Sub ListBox1_Click()
> > > mtb.Value = ListBox1.Value
> > > End Sub
> > >
> > > Private Sub TextBox1_Enter()
> > > Set mtb = TextBox1
> > > End Sub
> > >
> > > Private Sub TextBox2_Enter()
> > > Set mtb = TextBox2
> > > End Sub
> > >
> > > NickHK
> > >
> > > "David Macdonald" <(E-Mail Removed)> wrote in
> > > message news:3AF78A38-A698-4C63-9C7E-(E-Mail Removed)...
> > > > I've got my form with TextBoxes and I've got my calendar.
> > > > I've even got the thing loading all the necessary fields into the

> right
> > > > cells in a new correctly formatted row on my worksheet.
> > > > All of this thanks to posts I found here - I've learnt so much in the

> last
> > > 2
> > > > weeks!
> > > >
> > > > Three of the textboxes on this form need to take dates. How can I tell

> the
> > > > Calendar which of the three to send the data to ?
> > > > My solution:
> > > > Three separate calendars (and CommandButtons to send the Value) that

> only
> > > > become visible when the cursor enters the relative textbox. i.e.

> Calendar1
> > > > appears when entering TextBox1 then disappears after its button is
> > > clicked,
> > > > Calendar2 appears later on when entering TextBox2 etc. I could place

> them
> > > all
> > > > in the same position so to the user it'd look like the same calendar
> > > > appearing each time. I certainly don't want three calendars filling my
> > > form!
> > > >
> > > > Is there a more direct way ? Some property of textBoxes like

> "HasFocus" or
> > > > "IsActive" that I could use ?
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot open dates or make dates in my calendar Joey Microsoft Outlook Calendar 1 13th May 2009 02:03 PM
importing calendar dates in to outlook calendar 2007 =?Utf-8?B?QnJlbmRh?= Microsoft Outlook Discussion 0 14th Sep 2007 03:26 PM
Outlook calendar should also have days above dates on calendar vi. =?Utf-8?B?dTgyODU3Ng==?= Microsoft Outlook Calendar 0 1st Feb 2005 02:11 PM
Re: Copying calendar dates to another calendar Sue Mosher [MVP] Microsoft Outlook Calendar 0 27th Jan 2004 06:52 PM
Export Outlook (98) calendar dates for use on a calendar webpage in VCard format ©® Freeware 0 13th Oct 2003 06:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:03 PM.