RETRIEVING DATA FROM 1 FORM FIELD UPON ACTIVATING CHECK BOX

T

TAZ1NOLES

I have an Access form that I want to do the following:

Check Box: Battery Replaced
Field: Inspection Date
Field: Last Battery Change out


On yes then Last Battery Change out = Inspection Date based on the
Inspection Date field being populated & the Battery Replaced Check Box in Yes
state.

Any suggestions how I can code this as an event or any other ideas?

Thanks for your help.

PAT FEARNS
 
T

TAZ1NOLES

If the box isn't checked then nothing needs to happen. I want the population
of the battery replaced check box to trigger copy the date from the
inspection date field into the last battery change out field.

Also, does Me! represent the name of the table this form is populating into?

Sorry if I wasn't clear.

Thanks for your help.

PAT FEARNS


Dirk Goldgar said:
TAZ1NOLES said:
I have an Access form that I want to do the following:

Check Box: Battery Replaced
Field: Inspection Date
Field: Last Battery Change out


On yes then Last Battery Change out = Inspection Date based on the
Inspection Date field being populated & the Battery Replaced Check Box in
Yes
state.

Any suggestions how I can code this as an event or any other ideas?

Thanks for your help.

PAT FEARNS


Something like this code for the check box's AfterUpdate event:

'------ start of suggested code ------
Private Sub Battery_Replaced_AfterUpdate()

If Me![Battery Replaced] = True Then
If Not IsNull(Me![Inspection Date]) Then
Me![Last Battery Change out] = Me![Inspection Date]
End If
End If

End Sub
'------ end of suggested code ------

You didn't say what you wanted to have happen if the [Inspection Date] field
is Null, or if the check box is unchecked.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)
 
D

Dirk Goldgar

TAZ1NOLES said:
If the box isn't checked then nothing needs to happen. I want the
population
of the battery replaced check box to trigger copy the date from the
inspection date field into the last battery change out field.

Then the code I posted should do the trick.
Also, does Me! represent the name of the table this form is populating
into?

No, "Me" is a keyword that refers to the object in which the code is
running. It should not be replaced with anything else. In this case, with
the code running in an event of the form, "Me" would refer to that form.

If the names you gave were correct, the code should do what you want without
modification. If not, you may need to replace the control names.
 

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