control source in a field for a check box

G

Guest

I am trying to design a database for a daily dispatch log. I have figured
out how to log the ModifiedTime. Now I have four check boxes for:

Enrt On Scene Transporting Availible
Enrt Time On Scene Time etc...

I want to add next to them a field (I can do that) that will enter the time
the box was checked for each one. I can not figure out how to set the
control source or event procedure...HELP PLEASE....

Thanks Jennifer P
 
R

Rick Brandt

Jennifer said:
I am trying to design a database for a daily dispatch log. I have
figured out how to log the ModifiedTime. Now I have four check boxes
for:

Enrt On Scene Transporting Availible
Enrt Time On Scene Time etc...

I want to add next to them a field (I can do that) that will enter
the time the box was checked for each one. I can not figure out how
to set the control source or event procedure...HELP PLEASE....

Thanks Jennifer P

Do you have fields bound to these CheckBoxes? If so you are storing
redundant data. You don't need a CheckBox to indicate "Yes" this event
happend as well as a DateTime to indicate "when" it happened. You will know
the event happened by virtue of a DateTime having been entered and you know
an event has not yet happened by virtue of the DateTime still being Null.

So...all you really need are four CommandButtons that will enter the
DateTime when pressed. The code would be...

Me![FieldName] = Now()

....for each button. If you insist on keeping the unnecessary CheckBoxes
just use the AfterUpdate event of each one.

If Me.CheckBoxName = True Then Me![FieldName] = Now()
 
G

Guest

Okay I got rid of the check boxes left a field for enroute time but I can not
get the command button to work when clicked. I entered the code below and I
get an error saying I have to have a macro. I designed a macro under
setvalue with the following info:

[Enroute]
=Time()

Then I get an invalid syntax message...I NEED HELP...

Rick Brandt said:
Jennifer said:
I am trying to design a database for a daily dispatch log. I have
figured out how to log the ModifiedTime. Now I have four check boxes
for:

Enrt On Scene Transporting Availible
Enrt Time On Scene Time etc...

I want to add next to them a field (I can do that) that will enter
the time the box was checked for each one. I can not figure out how
to set the control source or event procedure...HELP PLEASE....

Thanks Jennifer P

Do you have fields bound to these CheckBoxes? If so you are storing
redundant data. You don't need a CheckBox to indicate "Yes" this event
happend as well as a DateTime to indicate "when" it happened. You will know
the event happened by virtue of a DateTime having been entered and you know
an event has not yet happened by virtue of the DateTime still being Null.

So...all you really need are four CommandButtons that will enter the
DateTime when pressed. The code would be...

Me![FieldName] = Now()

....for each button. If you insist on keeping the unnecessary CheckBoxes
just use the AfterUpdate event of each one.

If Me.CheckBoxName = True Then Me![FieldName] = Now()
 
R

Rick Brandt

Jennifer said:
Okay I got rid of the check boxes left a field for enroute time but I
can not get the command button to work when clicked. I entered the
code below and I get an error saying I have to have a macro. I
designed a macro under setvalue with the following info:

[Enroute]
=Time()

Then I get an invalid syntax message...I NEED HELP...

I can't help you with macros (never use em). For VBA code you need to go to
the OnClick event property for the button and enter "[Event Procedure]". It
will be one of the choices if you select from the drop-down list of choices
for the property.

After entering "[Event Procedure]" you press the build [...] button to the
right of the box and this will take you to the code window. Access will
have automatically created the two lines to define the start and end of the
code that will run when the button is pressed and your cursor will be
positioned in between those two lines. That is where you enter...

Me![Enroute] = Now()
 
G

Guest

Rick that worked miracles you are the best.....Jen

Rick Brandt said:
Jennifer said:
Okay I got rid of the check boxes left a field for enroute time but I
can not get the command button to work when clicked. I entered the
code below and I get an error saying I have to have a macro. I
designed a macro under setvalue with the following info:

[Enroute]
=Time()

Then I get an invalid syntax message...I NEED HELP...

I can't help you with macros (never use em). For VBA code you need to go to
the OnClick event property for the button and enter "[Event Procedure]". It
will be one of the choices if you select from the drop-down list of choices
for the property.

After entering "[Event Procedure]" you press the build [...] button to the
right of the box and this will take you to the code window. Access will
have automatically created the two lines to define the start and end of the
code that will run when the button is pressed and your cursor will be
positioned in between those two lines. That is where you enter...

Me![Enroute] = Now()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top