PC Review


Reply
Thread Tools Rate Thread

changing value of textbox with checkbox option

 
 
Haroon
Guest
Posts: n/a
 
      6th Feb 2009
hi

i have a form with a check box and textbox, when user ticks the checkbox, in
textbox i want todays date to appear.

anyone know how i can do that? is this possible?

cheers.
 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      6th Feb 2009
Haroon

That may be more work that you need to do.

What about the idea of allowing the user to double-click the textbox to load
in today's date?

Either way, you'd need to use a related event procedure, but by using the
double-click event, you don't need the extra checkbox control.

Create a new event procedure for the Double-Click event, add something like:

Me!YourTextboxControl = Date()

If you need date/time, use "=Now()"

Regards

Jeff Boyce
Microsoft Office/Access MVP

"Haroon" <(E-Mail Removed)> wrote in message
newsBB2CC77-C187-4249-A20C-(E-Mail Removed)...
> hi
>
> i have a form with a check box and textbox, when user ticks the checkbox,
> in
> textbox i want todays date to appear.
>
> anyone know how i can do that? is this possible?
>
> cheers.



 
Reply With Quote
 
Jim Burke in Novi
Guest
Posts: n/a
 
      6th Feb 2009
Put this code in the checkbox's After Update event proc:

if myCheckBox then 'put the checkbox control name here
myTextBox = Date() ' this is the name of your text box
else
myTextBox = null
end if

"Haroon" wrote:

> hi
>
> i have a form with a check box and textbox, when user ticks the checkbox, in
> textbox i want todays date to appear.
>
> anyone know how i can do that? is this possible?
>
> cheers.

 
Reply With Quote
 
dymondjack
Guest
Posts: n/a
 
      6th Feb 2009
Try putting some code in the OnChange event of the checkbox:


If Me.CheckBoxName = True Then
Me.TextBoxName = Format(Now(), "mm/dd/yyyy")
End If


--
Jack Leach
www.tristatemachine.com

- "First, get your information. Then, you can distort it at your leisure."
- Mark Twain


"Haroon" wrote:

> hi
>
> i have a form with a check box and textbox, when user ticks the checkbox, in
> textbox i want todays date to appear.
>
> anyone know how i can do that? is this possible?
>
> cheers.

 
Reply With Quote
 
Ken Snell \(MVP\)
Guest
Posts: n/a
 
      6th Feb 2009
Use the AfterUpdate event of the checkbox to run code similar to this:

Private Sub NameOfCheckbox_AfterUpdate()
Select Case Me.NameOfCheckbox.Value
Case True
Me.NameOfTextbox.Value = Date()
' if you don't want to overwrite a value that is already in the
textbox,
' then use this next code step instead of the one above
'If Len(Me.NameOfTextbox.Value & vbNullString) = 0 Then _
' Me.NameOfTextbox.Value = Date()
Case False
' put code here to do something when checkbox is unchecked
End Select
End Sub

--

Ken Snell
<MS ACCESS MVP>
http://www.accessmvp.com/KDSnell/



"Haroon" <(E-Mail Removed)> wrote in message
newsBB2CC77-C187-4249-A20C-(E-Mail Removed)...
> hi
>
> i have a form with a check box and textbox, when user ticks the checkbox,
> in
> textbox i want todays date to appear.
>
> anyone know how i can do that? is this possible?
>
> cheers.



 
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
Checkbox into a textbox =?Utf-8?B?amFjMDA3?= Microsoft Access Forms 4 18th Oct 2006 08:06 PM
checkbox + textbox Dreamer Microsoft Access 1 1st Jun 2005 05:10 PM
Checkbox populates Textbox JTART2 Microsoft Access Forms 1 20th Nov 2004 05:31 AM
toggle/checkbox to textbox adriany Microsoft Access Form Coding 1 3rd Jun 2004 05:49 PM
CheckBox: Changing Only Checkbox not Text Backcolor =?Utf-8?B?TWFyaw==?= Microsoft Dot NET Framework Forms 0 29th Apr 2004 05:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:54 AM.