Table -- default value

G

Guest

I'm using Access 2007 on a Windows XP computer.

I have two tables ... tblemployees and tbltimeworked. In the tblemployees,
I have a field "acct". This field may change throughout the year, according
to where the employee is working. In the tbletimeworked, I would like to add
a field "acct" that would tell me what account the employee was charged to
during that time period. I would like the default for this field to be
tblemployees.acct. My thought is that tbltimeworked.acct is a static field
but tblemployees.acct is dynamic, which is why I need the field in timeworked.

How would I program the table for the default value?
 
J

Jeff Boyce

Margaret

It sounds like you are trying to work directly in the tables. This is how
you'd handle this ... if you were using a spreadsheet! Access tables store
data, Access forms display it and are used for data entry/edit.

If I were faced with the situation you describe, I would set up a "main"
form based on the tblEmployee (or more likely, on a query against that
table). Then I'd create another form that I would "embed" in the main form
(as a "sub-"form). I would link the subform to the main form on EmployeeID
and ACCT fields.

That way, every time you made an entry in the subform ("#" hours worked),
Access would automatically enter the EmployeeID and ACCT from the main form
(i.e., table) into the subform's table.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Yea, after I posted I realized that I might need to do that through a query
in the form I already had set up.

I have the form set up as a continuous form and a subform would be difficult
(not impossible ... just difficult). On tbltimeworked I added a field
acctpaf and I would like to enter the tblemployee.acct into that field. in
the [frmtimeworked] I already populate the fields lastname, firstname and
acct via the tblemployees.emp field. (Obviously I don't add these to
tbltimeworked ... just the tblemployees.emp number, which is the common info
between the tables). Other than using a subform, how can I get the
tbltimeworked.acctpaf to default to the tblemployee.acct information using
the form?
 
J

Jeff Boyce

Margaret

Perhaps one of the other newsgroup readers can offer their experience in
doing it your way. My experience is with letting Access do the "heavy
lifting"... After all, if the Employee and Acct are already know, why force
the user to re-enter that information?

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

margaret said:
Yea, after I posted I realized that I might need to do that through a
query
in the form I already had set up.

I have the form set up as a continuous form and a subform would be
difficult
(not impossible ... just difficult). On tbltimeworked I added a field
acctpaf and I would like to enter the tblemployee.acct into that field.
in
the [frmtimeworked] I already populate the fields lastname, firstname and
acct via the tblemployees.emp field. (Obviously I don't add these to
tbltimeworked ... just the tblemployees.emp number, which is the common
info
between the tables). Other than using a subform, how can I get the
tbltimeworked.acctpaf to default to the tblemployee.acct information using
the form?

Jeff Boyce said:
Margaret

It sounds like you are trying to work directly in the tables. This is
how
you'd handle this ... if you were using a spreadsheet! Access tables
store
data, Access forms display it and are used for data entry/edit.

If I were faced with the situation you describe, I would set up a "main"
form based on the tblEmployee (or more likely, on a query against that
table). Then I'd create another form that I would "embed" in the main
form
(as a "sub-"form). I would link the subform to the main form on
EmployeeID
and ACCT fields.

That way, every time you made an entry in the subform ("#" hours worked),
Access would automatically enter the EmployeeID and ACCT from the main
form
(i.e., table) into the subform's table.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Believe you me ... I have no desire for the user to re-enter the information
and if the only way to fix this is to do a sub-form ... well then that's what
I'll do.

Thanks for all your help.

Jeff Boyce said:
Margaret

Perhaps one of the other newsgroup readers can offer their experience in
doing it your way. My experience is with letting Access do the "heavy
lifting"... After all, if the Employee and Acct are already know, why force
the user to re-enter that information?

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

margaret said:
Yea, after I posted I realized that I might need to do that through a
query
in the form I already had set up.

I have the form set up as a continuous form and a subform would be
difficult
(not impossible ... just difficult). On tbltimeworked I added a field
acctpaf and I would like to enter the tblemployee.acct into that field.
in
the [frmtimeworked] I already populate the fields lastname, firstname and
acct via the tblemployees.emp field. (Obviously I don't add these to
tbltimeworked ... just the tblemployees.emp number, which is the common
info
between the tables). Other than using a subform, how can I get the
tbltimeworked.acctpaf to default to the tblemployee.acct information using
the form?

Jeff Boyce said:
Margaret

It sounds like you are trying to work directly in the tables. This is
how
you'd handle this ... if you were using a spreadsheet! Access tables
store
data, Access forms display it and are used for data entry/edit.

If I were faced with the situation you describe, I would set up a "main"
form based on the tblEmployee (or more likely, on a query against that
table). Then I'd create another form that I would "embed" in the main
form
(as a "sub-"form). I would link the subform to the main form on
EmployeeID
and ACCT fields.

That way, every time you made an entry in the subform ("#" hours worked),
Access would automatically enter the EmployeeID and ACCT from the main
form
(i.e., table) into the subform's table.

Regards

Jeff Boyce
Microsoft Office/Access MVP

I'm using Access 2007 on a Windows XP computer.

I have two tables ... tblemployees and tbltimeworked. In the
tblemployees,
I have a field "acct". This field may change throughout the year,
according
to where the employee is working. In the tbletimeworked, I would like
to
add
a field "acct" that would tell me what account the employee was charged
to
during that time period. I would like the default for this field to be
tblemployees.acct. My thought is that tbltimeworked.acct is a static
field
but tblemployees.acct is dynamic, which is why I need the field in
timeworked.

How would I program the table for the default value?
 

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