okay, well, you didn't provide any information about your
tables/relationships structure, so i'll assume you have: 1) a tblEmployees
which stores data about each employee - one employee per record, and 2) a
tblEmployeeTimesheets which stores data about each employee's "time" for
each day - one "time" for one employee per record, with a foreign key
linking back to the primary key of tblEmployees. so there is a one-to-many
relationship between tblEmployees and tblEmployeeTimesheets: one employee
may have many timesheet records, but each timesheet record belongs to only
one employee.
if the above describes your tables/relationships setup, then recommend you
use a mainform/subform setup. the main form will be bound to tblEmployees
and the subform will be bound to tblEmployeeTimesheets; the forms will be
linked by the primary/foreign key fields in the two tables. with that setup,
choosing an employee record in the main form will automatically filter the
timesheet records in the subform, and *automatically* fill in the
appropriate foreign key value when you add new timesheet records. you can
use an unbound textbox control in the mainform to enter the date, and set
the DefaultValue of the date control in the subform to pick up that date
when a new record is entered, as
[Forms]![MainFormName]![TextboxControlName]
the above setup achieves your goal, without using any macros or VBA code at
all.
note that you can also leave the main form unbound, if you'd rather, and
simply put an unbound combo box control on the main form; use tblEmployees
in the combo box's RowSource, and make sure the BoundColumn is the primary
key field in tblEmployees. then in the subform control (within the main
form), set the LinkMasterFields property to the name of the combo box
control, as
[ComboboxControlName]
to see the subform records of a given employee, simply select that employee
in the combo box's "droplist".
hth
Frank Wagner said:
The On-Enter property of the date control on the records in the detail
section of the form copies the data from the header to the detail
record
with
the statement:
Me.DetailDate = Me.HeaderDate
Me.DetailEmployeeNumber = Me.HeaderEmployeeNumber
I suppose that I could just re-enter the EmployeeNumber in the header
section, and go to the next record in the detail section, but it would be
much cleaner if only time entries for the new employee would appear.
Frank Wagner
--
Frank Wagner
(e-mail address removed)
:
In the form header, the user enters the
employee number and the date, that data is carried forward into
all
the
time
entry records for that employee for the day
*how* is that data being carried forward into the records in the form's
detail section? if the controls in the header section are unbound,
can't
you
just change the employee number there, and begin entering more
records
in
the detail section?
i think we need a clearer picture of how the form works, and how the data is
set up in your table(s), so we can understand the problem and offer
suggestions.
hth
I have a continuous form in the data entry mode for entering time sheets
for
each employee using Access 2000. In the form header, the user
enters
the
employee number and the date, that data is carried forward into
all
the
time
entry records for that employee for the day, which are continuous records
on
the same page. My question is how do I move the form back to the blank
data
entry mode for the next employee.
If I use pageup or pagedown, it just goes to the next record on the
continuous part of the form for for the same employee. I want to
go
the a
blank form for the next employee. I am familiar with visual
basic, so
if
I
need a button in the footer of the form and you tell me the
coding, I
can
add
it.
Any help would be appreciated. Thanks