By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,730 Members | 1,156 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,730 IT Pros & Developers. It's quick & easy.

Tick box

P: n/a
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
Apr 3 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

<pa**********@networkrail.co.ukwrote in message
news:72**********************************@u36g2000 prf.googlegroups.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
Apr 3 '08 #2

P: n/a
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.
Apr 3 '08 #3

P: n/a
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.

<pa**********@networkrail.co.ukwrote in message
news:2b**********************************@d21g2000 prf.googlegroups.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.
Apr 3 '08 #4

P: n/a
pa**********@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
Apr 3 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.