Re: Using checkbox to place today'sa date
- From: "AccessVandal via AccessMonster.com" <u18947@uwe>
- Date: Fri, 30 Mar 2007 05:10:29 GMT
Hi Frank,
Be aware that the code below will always show the current date when the user
check and uncheck and than check again. You’ll need to idiot proof your form
to prevent unwanted changes.
DateSelect: IIf([Select]=True,Date(),"")
Assuming “DateSelect” = Textbox and “Select” = Checkbox is the control names
you have create that form.
First, what you need to do is to create a new field/column in your table and
name it like “DateSelect”.
Second, you need to include the new field/column in the Form’s Record Source
as well. (Your query grid)
Next, go to the design mode of the form and go to the control name
“DateSelect”, in the properties of the control, set the “Control Source” =
DateSelect. This is the new field/column you have just created.
In the checkbox control, use the OnClick event to populate the Textbox.
It’s on the control properties tab called “Event”, on the Event Tab, just
look for “On Click”, click on the field and on the right of that field, there
is a Combobox arrow, click and select “[Event Procedure]”. Beside the
ComboBox, click the button “…” to view the VB editor.
This is the event we want to use.
Again assuming “Select” is the checkbox control name.
Private Sub Select_Click()
If IsNull(Me.DateSelect) Then
Me.DateSelect = Date() ‘input current date
End If
End Sub
And to idiot proof the checkbox. Use the Form’s current event.
Private Sub Form_Current()
If Not IsNull(Me.DateSelect) Then
Me.Select.Enable = False ‘disable the control
Else
Me.Select.Enable = True ‘enable the control
End If
End Sub
The above are only sample and not a complete solution. Get an Access
developer if you need a complete solution and security to prevent unwanted
changes (if you can afford one)
Frank Situmorang wrote:
Thanks Doug for your explanation, we appreciate if you could give me more
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200703/1
.
- References:
- Re: Using checkbox to place today'sa date
- From: Douglas J. Steele
- Re: Using checkbox to place today'sa date
- Prev by Date: Populating a text box from query results
- Next by Date: Re: Next number based on current record
- Previous by thread: Re: Using checkbox to place today'sa date
- Next by thread: Re: Using checkbox to place today'sa date
- Index(es):
Relevant Pages
|