Re: Using checkbox to place today'sa date

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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

.



Relevant Pages

  • Re: check boxes, eye dots ...
    ... So what is the step/steps to get to checkbox control ... ... > TIA ... >> VBA code would read the controls' values and do something with them. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Quality assurance for CNC programs - Help needed.
    ... point should a 'reset' key press clear out any variable. ... buffer, yes, reset plc counters and timers, yes, reset the plc and nc to ... However if the variables were actually Zero in the control, ... You can't 'idiot proof' anything....every time you try, ...
    (alt.machines.cnc)
  • Re: ActiveControl in Form View
    ... >I have a form with a checkbox control and a text field. ... >My question is why does Access think the window is not active? ... Is ActiveControl not available in the ...
    (microsoft.public.access.formscoding)
  • Re: Using checkbox to place todaysa date
    ... I have tried your suggestion Vandals, but error messages says " Compiled ... Could you give me more explanation. ... In the checkbox control, use the OnClick event to populate the Textbox. ...
    (microsoft.public.access.forms)
  • Re: What the hell am I doing wrong?
    ... but on my offset smoker when the smoking chamber got too hot, ... Then I'd adjust the intake vents and get the silly thing under control. ... Make it idiot proof and someone will make a better idiot. ...
    (alt.food.barbecue)