Clear a field by checking a box?

T

Terrance Popos

When an asset is assigned to an employee, that employee's information is
filled out on the form. When the asset is no longer assigned to an
employee, I would like to check a checkbox name Unassigned, which would
clear all the fields pertaining to the employee.

I have seen elsewhere the following:

Private Sub Checkbox_AfterUpdate()
If Me![Checkbox] = True Then
[Me![OtherControlName] = "X"]
Else
[Me![OtherControlName] = Null]
End If
End Sub

While I know this won't implicitly work for my purposes, it seems as though
it is the correct direction. My question is how do I need to mod this to
do what I need?

What I need: By default, the checkbox is unchecked, and the field named
AssignedLastName and four other fields are ready to be edited, or already
contain a previously entered value. When checked, I want these fields to
be cleared of their values, and disabled so no value can be entered
manually until the Unassigned checkbox is unchecked.

Also, what does Me! refer to?

Thank you.

TP
 
K

KARL DEWEY

I think you would want to keep better records than that.
If you use and employee, asset, and usage table like this ---
Employee --
EmpID - autonumber - primary key
LName
FName
MI
etc.

Asset --
AssetID - autonumber - primary key
Name
Type
etc.

Usage --
UseID - autonumber - primary key
AssetID - integer - foreign key
EmpID - integer - foreign key
DateOut - DateTime
DateIn - DateTime
Rmks - memo

Set a one-to-many relationship between the Employee and the Usage table.
Also between the Asset and Usage table.

Use a form/subform for employee/asset as one employee can have many assets
out at any one time. The query for the assets to pull records where the
InDate is null.

You can do analysis on an asset as to how often it is used and how long each
time.
 

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