PC Review


Reply
Thread Tools Rate Thread

Automatically displaying text in a form

 
 
Risky Dave
Guest
Posts: n/a
 
      27th Jun 2009

Hi,

I have a user form that captures information across a set of tabs.

What I would like to do is capture a date entered in one tab and
automatically display this value plus 8 years in a field on a different tab
in the form.

The code I have (embedded into the second tab) is:

Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
With Me.tb8YO
.Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
.Text = Format(.Text, "dd-mmm-yy")
End With
End Sub

I assume that this is assigning the correct value to the text box (I'm not
getting any error messages telling me otherwise), but it is not actually
displaying the value (tbDoB.value plus 8 years) in the text box.

What am I doing wrong?

TIA

Dave
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      27th Jun 2009

Dave, try

Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Risky Dave" wrote:

> Hi,
>
> I have a user form that captures information across a set of tabs.
>
> What I would like to do is capture a date entered in one tab and
> automatically display this value plus 8 years in a field on a different tab
> in the form.
>
> The code I have (embedded into the second tab) is:
>
> Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> With Me.tb8YO
> .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
> .Text = Format(.Text, "dd-mmm-yy")
> End With
> End Sub
>
> I assume that this is assigning the correct value to the text box (I'm not
> getting any error messages telling me otherwise), but it is not actually
> displaying the value (tbDoB.value plus 8 years) in the text box.
>
> What am I doing wrong?
>
> TIA
>
> Dave

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      27th Jun 2009

Correction..

Me.tb8YO.Text =Format(DateAdd("yyyy",8,Me.tbDoB),"dd-mmm-yy")

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

> Dave, try
>
> Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
> End Sub
>
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Risky Dave" wrote:
>
> > Hi,
> >
> > I have a user form that captures information across a set of tabs.
> >
> > What I would like to do is capture a date entered in one tab and
> > automatically display this value plus 8 years in a field on a different tab
> > in the form.
> >
> > The code I have (embedded into the second tab) is:
> >
> > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> > With Me.tb8YO
> > .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
> > .Text = Format(.Text, "dd-mmm-yy")
> > End With
> > End Sub
> >
> > I assume that this is assigning the correct value to the text box (I'm not
> > getting any error messages telling me otherwise), but it is not actually
> > displaying the value (tbDoB.value plus 8 years) in the text box.
> >
> > What am I doing wrong?
> >
> > TIA
> >
> > Dave

 
Reply With Quote
 
Risky Dave
Guest
Posts: n/a
 
      27th Jun 2009

Jacob,

Thanks for the quick reply. unfortunately, this still isn't working - the
field that should show the date plus 8 years is still blank :-(

"Jacob Skaria" wrote:

> Correction..
>
> Me.tb8YO.Text =Format(DateAdd("yyyy",8,Me.tbDoB),"dd-mmm-yy")
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Jacob Skaria" wrote:
>
> > Dave, try
> >
> > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> > Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
> > End Sub
> >
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Risky Dave" wrote:
> >
> > > Hi,
> > >
> > > I have a user form that captures information across a set of tabs.
> > >
> > > What I would like to do is capture a date entered in one tab and
> > > automatically display this value plus 8 years in a field on a different tab
> > > in the form.
> > >
> > > The code I have (embedded into the second tab) is:
> > >
> > > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> > > With Me.tb8YO
> > > .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
> > > .Text = Format(.Text, "dd-mmm-yy")
> > > End With
> > > End Sub
> > >
> > > I assume that this is assigning the correct value to the text box (I'm not
> > > getting any error messages telling me otherwise), but it is not actually
> > > displaying the value (tbDoB.value plus 8 years) in the text box.
> > >
> > > What am I doing wrong?
> > >
> > > TIA
> > >
> > > Dave

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      27th Jun 2009

1. Check whether this code is getting executed. Place a msgbox and check. I
dont think the code is getting executed; or otherwise it should have given an
error in the first place.

2. Check whether the control names are correct tb8YO.

If this post helps click Yes
---------------
Jacob Skaria


"Risky Dave" wrote:

> Jacob,
>
> Thanks for the quick reply. unfortunately, this still isn't working - the
> field that should show the date plus 8 years is still blank :-(
>
> "Jacob Skaria" wrote:
>
> > Correction..
> >
> > Me.tb8YO.Text =Format(DateAdd("yyyy",8,Me.tbDoB),"dd-mmm-yy")
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Jacob Skaria" wrote:
> >
> > > Dave, try
> > >
> > > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> > > Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
> > > End Sub
> > >
> > >
> > > If this post helps click Yes
> > > ---------------
> > > Jacob Skaria
> > >
> > >
> > > "Risky Dave" wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a user form that captures information across a set of tabs.
> > > >
> > > > What I would like to do is capture a date entered in one tab and
> > > > automatically display this value plus 8 years in a field on a different tab
> > > > in the form.
> > > >
> > > > The code I have (embedded into the second tab) is:
> > > >
> > > > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> > > > With Me.tb8YO
> > > > .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
> > > > .Text = Format(.Text, "dd-mmm-yy")
> > > > End With
> > > > End Sub
> > > >
> > > > I assume that this is assigning the correct value to the text box (I'm not
> > > > getting any error messages telling me otherwise), but it is not actually
> > > > displaying the value (tbDoB.value plus 8 years) in the text box.
> > > >
> > > > What am I doing wrong?
> > > >
> > > > TIA
> > > >
> > > > Dave

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      27th Jun 2009

Where is your TextBox located at... on the worksheet or on a UserForm?

--
Rick (MVP - Excel)


"Risky Dave" <(E-Mail Removed)> wrote in message
news:2DD9060B-7948-4A30-9BAD-(E-Mail Removed)...
> Jacob,
>
> Thanks for the quick reply. unfortunately, this still isn't working - the
> field that should show the date plus 8 years is still blank :-(
>
> "Jacob Skaria" wrote:
>
>> Correction..
>>
>> Me.tb8YO.Text =Format(DateAdd("yyyy",8,Me.tbDoB),"dd-mmm-yy")
>>
>> If this post helps click Yes
>> ---------------
>> Jacob Skaria
>>
>>
>> "Jacob Skaria" wrote:
>>
>> > Dave, try
>> >
>> > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
>> > Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
>> > End Sub
>> >
>> >
>> > If this post helps click Yes
>> > ---------------
>> > Jacob Skaria
>> >
>> >
>> > "Risky Dave" wrote:
>> >
>> > > Hi,
>> > >
>> > > I have a user form that captures information across a set of tabs.
>> > >
>> > > What I would like to do is capture a date entered in one tab and
>> > > automatically display this value plus 8 years in a field on a
>> > > different tab
>> > > in the form.
>> > >
>> > > The code I have (embedded into the second tab) is:
>> > >
>> > > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
>> > > With Me.tb8YO
>> > > .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
>> > > .Text = Format(.Text, "dd-mmm-yy")
>> > > End With
>> > > End Sub
>> > >
>> > > I assume that this is assigning the correct value to the text box
>> > > (I'm not
>> > > getting any error messages telling me otherwise), but it is not
>> > > actually
>> > > displaying the value (tbDoB.value plus 8 years) in the text box.
>> > >
>> > > What am I doing wrong?
>> > >
>> > > TIA
>> > >
>> > > Dave


 
Reply With Quote
 
Risky Dave
Guest
Posts: n/a
 
      27th Jun 2009
Rick the text box is on a user form called from a worksheet by the user
selecting a button.

What I am trying to do is have a field on one tab on the form automatically
populated by a user entry into another text box on a different tab on the form

TIA

Dave

"Rick Rothstein" wrote:

> Where is your TextBox located at... on the worksheet or on a UserForm?
>
> --
> Rick (MVP - Excel)
>
>
> "Risky Dave" <(E-Mail Removed)> wrote in message
> news:2DD9060B-7948-4A30-9BAD-(E-Mail Removed)...
> > Jacob,
> >
> > Thanks for the quick reply. unfortunately, this still isn't working - the
> > field that should show the date plus 8 years is still blank :-(
> >
> > "Jacob Skaria" wrote:
> >
> >> Correction..
> >>
> >> Me.tb8YO.Text =Format(DateAdd("yyyy",8,Me.tbDoB),"dd-mmm-yy")
> >>
> >> If this post helps click Yes
> >> ---------------
> >> Jacob Skaria
> >>
> >>
> >> "Jacob Skaria" wrote:
> >>
> >> > Dave, try
> >> >
> >> > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> >> > Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
> >> > End Sub
> >> >
> >> >
> >> > If this post helps click Yes
> >> > ---------------
> >> > Jacob Skaria
> >> >
> >> >
> >> > "Risky Dave" wrote:
> >> >
> >> > > Hi,
> >> > >
> >> > > I have a user form that captures information across a set of tabs.
> >> > >
> >> > > What I would like to do is capture a date entered in one tab and
> >> > > automatically display this value plus 8 years in a field on a
> >> > > different tab
> >> > > in the form.
> >> > >
> >> > > The code I have (embedded into the second tab) is:
> >> > >
> >> > > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> >> > > With Me.tb8YO
> >> > > .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
> >> > > .Text = Format(.Text, "dd-mmm-yy")
> >> > > End With
> >> > > End Sub
> >> > >
> >> > > I assume that this is assigning the correct value to the text box
> >> > > (I'm not
> >> > > getting any error messages telling me otherwise), but it is not
> >> > > actually
> >> > > displaying the value (tbDoB.value plus 8 years) in the text box.
> >> > >
> >> > > What am I doing wrong?
> >> > >
> >> > > TIA
> >> > >
> >> > > Dave

>
>

 
Reply With Quote
 
Risky Dave
Guest
Posts: n/a
 
      27th Jun 2009
Guys,

Just realised I was being stupid!

I was trying to get one txt box to identify a chnage in state in another
one. What I've done is simply have the source (tbDoB) textbox run a couple of
lines to drop the appropriate information into the target textbox (tb8YO)
after an Update Event.

Thanks for your time anyway,

Dave

"Rick Rothstein" wrote:

> Where is your TextBox located at... on the worksheet or on a UserForm?
>
> --
> Rick (MVP - Excel)
>
>
> "Risky Dave" <(E-Mail Removed)> wrote in message
> news:2DD9060B-7948-4A30-9BAD-(E-Mail Removed)...
> > Jacob,
> >
> > Thanks for the quick reply. unfortunately, this still isn't working - the
> > field that should show the date plus 8 years is still blank :-(
> >
> > "Jacob Skaria" wrote:
> >
> >> Correction..
> >>
> >> Me.tb8YO.Text =Format(DateAdd("yyyy",8,Me.tbDoB),"dd-mmm-yy")
> >>
> >> If this post helps click Yes
> >> ---------------
> >> Jacob Skaria
> >>
> >>
> >> "Jacob Skaria" wrote:
> >>
> >> > Dave, try
> >> >
> >> > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> >> > Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
> >> > End Sub
> >> >
> >> >
> >> > If this post helps click Yes
> >> > ---------------
> >> > Jacob Skaria
> >> >
> >> >
> >> > "Risky Dave" wrote:
> >> >
> >> > > Hi,
> >> > >
> >> > > I have a user form that captures information across a set of tabs.
> >> > >
> >> > > What I would like to do is capture a date entered in one tab and
> >> > > automatically display this value plus 8 years in a field on a
> >> > > different tab
> >> > > in the form.
> >> > >
> >> > > The code I have (embedded into the second tab) is:
> >> > >
> >> > > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
> >> > > With Me.tb8YO
> >> > > .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
> >> > > .Text = Format(.Text, "dd-mmm-yy")
> >> > > End With
> >> > > End Sub
> >> > >
> >> > > I assume that this is assigning the correct value to the text box
> >> > > (I'm not
> >> > > getting any error messages telling me otherwise), but it is not
> >> > > actually
> >> > > displaying the value (tbDoB.value plus 8 years) in the text box.
> >> > >
> >> > > What am I doing wrong?
> >> > >
> >> > > TIA
> >> > >
> >> > > Dave

>
>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      27th Jun 2009

When you say "tab on the form", are you using a MultiPage or a TabStrip
control (or perhaps something else) to hold your TextBoxes?

--
Rick (MVP - Excel)


"Risky Dave" <(E-Mail Removed)> wrote in message
news:98354055-177A-4293-98E4-(E-Mail Removed)...
> Rick the text box is on a user form called from a worksheet by the user
> selecting a button.
>
> What I am trying to do is have a field on one tab on the form
> automatically
> populated by a user entry into another text box on a different tab on the
> form
>
> TIA
>
> Dave
>
> "Rick Rothstein" wrote:
>
>> Where is your TextBox located at... on the worksheet or on a UserForm?
>>
>> --
>> Rick (MVP - Excel)
>>
>>
>> "Risky Dave" <(E-Mail Removed)> wrote in message
>> news:2DD9060B-7948-4A30-9BAD-(E-Mail Removed)...
>> > Jacob,
>> >
>> > Thanks for the quick reply. unfortunately, this still isn't working -
>> > the
>> > field that should show the date plus 8 years is still blank :-(
>> >
>> > "Jacob Skaria" wrote:
>> >
>> >> Correction..
>> >>
>> >> Me.tb8YO.Text =Format(DateAdd("yyyy",8,Me.tbDoB),"dd-mmm-yy")
>> >>
>> >> If this post helps click Yes
>> >> ---------------
>> >> Jacob Skaria
>> >>
>> >>
>> >> "Jacob Skaria" wrote:
>> >>
>> >> > Dave, try
>> >> >
>> >> > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As
>> >> > MSForms.ReturnBoolean)
>> >> > Me.tb8YO.Text =Format(DateAdd("y",8,Me.tbDoB),"dd-mmm-yy")
>> >> > End Sub
>> >> >
>> >> >
>> >> > If this post helps click Yes
>> >> > ---------------
>> >> > Jacob Skaria
>> >> >
>> >> >
>> >> > "Risky Dave" wrote:
>> >> >
>> >> > > Hi,
>> >> > >
>> >> > > I have a user form that captures information across a set of tabs.
>> >> > >
>> >> > > What I would like to do is capture a date entered in one tab and
>> >> > > automatically display this value plus 8 years in a field on a
>> >> > > different tab
>> >> > > in the form.
>> >> > >
>> >> > > The code I have (embedded into the second tab) is:
>> >> > >
>> >> > > Private Sub tb8YO_BeforeUpdate(ByVal Cancel As
>> >> > > MSForms.ReturnBoolean)
>> >> > > With Me.tb8YO
>> >> > > .Value = tbDoB.Value.DateAdd("yyyy", 8, .Value)
>> >> > > .Text = Format(.Text, "dd-mmm-yy")
>> >> > > End With
>> >> > > End Sub
>> >> > >
>> >> > > I assume that this is assigning the correct value to the text box
>> >> > > (I'm not
>> >> > > getting any error messages telling me otherwise), but it is not
>> >> > > actually
>> >> > > displaying the value (tbDoB.value plus 8 years) in the text box.
>> >> > >
>> >> > > What am I doing wrong?
>> >> > >
>> >> > > TIA
>> >> > >
>> >> > > Dave

>>
>>


 
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
Problem in displaying a text box in access form in controltip text Jack Microsoft Access Form Coding 1 20th Aug 2009 09:42 PM
Displaying Text on a Forms 2 Form Alan Forsyth Microsoft Excel Programming 2 28th Dec 2007 03:24 PM
Displaying text on a form form a umanaged callback C++/C# problem bob Microsoft VC .NET 0 26th Jun 2005 02:31 PM
Automatically displaying values on a Form =?Utf-8?B?TGFycnk=?= Microsoft Access Forms 2 4th Apr 2005 02:05 PM
Varchar text not displaying correctly in form or report text boxes =?Utf-8?B?Q29va2ll?= Microsoft Access ADP SQL Server 0 13th Oct 2004 10:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:11 AM.