Tick box
am 03.04.2008 13:37:15 von paul.bentleyI am trying to get a "Date entered" box to automatically fill when a
tick box = true, without success so its over to the experts for some
much needed help
Thanks in advance
I am trying to get a "Date entered" box to automatically fill when a
tick box = true, without success so its over to the experts for some
much needed help
Thanks in advance
So you want the field named "Date Entered" to fill in with todays date and
time, when the user checks a yes/no field named (say) IsPicked?
Use the AfterUpdate event procedure of the check box in your form. Something
like this:
Private Sub IsPicked_AfterUpdate()
If Me.IsPicked.Value Then
Me.[Date Entered] = Now()
Else
Me.[Date Entered] = Null
End If
End Sub
Use Date() instead of Now() if you only want the date (not the time as
well.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
news:722b0a15-7160-4738-8e70-2778ad65afb9@u36g2000prf.google groups.com...
>I am trying to get a "Date entered" box to automatically fill when a
> tick box = true, without success so its over to the experts for some
> much needed help
> Thanks in advance
On 3 Apr, 12:37, paul.bent...@networkrail.co.uk wrote:
> I am trying to get a "Date entered" box to automatically fill when a
> tick box = true, without success so its over to the experts for some
> much needed help
> Thanks in advance
Additionally I have used the following
Private Sub Statement_Sent_AfterUpdate
If Me![Statement Sent] = True Then
Me![Statement Sent Date] = Date
Else
Me![Statement Sent Date] = Null
End If
End Sub
Which works but i have 143 records and even if i only tick on of the
yes/no boxes All of the Date entered boxes i have fill in, I want the
system to just date the one record for which the tick box refers.
If you want to make this change for all your existing records as well, use
an Update query.
1. Create a query using this table.
2. In the Criteria under the [Statement Sent field], enter:
True
3. In the Criteria under the [Statement Sent Date], enter:
Is Null
4. Change it to an Update query (Update on Query menu.)
5. In the Update row under [Statement Sent Date], enter:
Date()
6. Run the query.
The relevant rows will now contain today's date.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
news:2b4b7589-97e5-4cd8-8042-267e93e10fca@d21g2000prf.google groups.com...
> On 3 Apr, 12:37, paul.bent...@networkrail.co.uk wrote:
>> I am trying to get a "Date entered" box to automatically fill when a
>> tick box = true, without success so its over to the experts for some
>> much needed help
>> Thanks in advance
>
> Additionally I have used the following
> Private Sub Statement_Sent_AfterUpdate
> If Me![Statement Sent] = True Then
> Me![Statement Sent Date] = Date
> Else
> Me![Statement Sent Date] = Null
> End If
> End Sub
>
>
> Which works but i have 143 records and even if i only tick on of the
> yes/no boxes All of the Date entered boxes i have fill in, I want the
> system to just date the one record for which the tick box refers.
paul.bentley@networkrail.co.uk wrote:
> On 3 Apr, 12:37, paul.bent...@networkrail.co.uk wrote:
>
>>I am trying to get a "Date entered" box to automatically fill when a
>>tick box = true, without success so its over to the experts for some
>>much needed help
>>Thanks in advance
>
>
> Additionally I have used the following
> Private Sub Statement_Sent_AfterUpdate
> If Me![Statement Sent] = True Then
> Me![Statement Sent Date] = Date
> Else
> Me![Statement Sent Date] = Null
> End If
> End Sub
>
>
> Which works but i have 143 records and even if i only tick on of the
> yes/no boxes All of the Date entered boxes i have fill in, I want the
> system to just date the one record for which the tick box refers.
If this is a form, this code will be pretty close. I simply add "Date"
after the fieldname/textbox
Private Sub Tick_AfterUpdate()
Dim ctl As Control
Dim frm As Form
For Each ctl In Me.Controls
Select Case ctl.ControlType
Case acCheckBox
If ctl.name <> "Tick" Then
'space then date to end of checkbox name
Me(ctlName & " Date").Value = IIf(Me.Tick, Date, Null)
End If
Case Else
End Select
Next
End Sub
Ice Cube
http://www.youtube.com/watch?v=HzeZhCt5PVA