controlling the flow

S

slowuptake

I have a form that contains a set of 3 combo boxes allowing user to choose
employee, month and year (of monthly timesheets eventually). Then I have a
button with some some event code ( a DLookup courtesy of 2 MVP's) that will
take the values in the combo boxes and return the timesheet ID (primary key
number) of the unique record in a table that contains those 3 values. But I
haven't yet done anything with the ID value except look it up and store it as
a local variable in the button's event code.

I thought next to add a subform that would sort the detailed time entries by
the time sheet ID returned by the button event code. This subform is already
working - standalone.

My immediate problem is that the user entered values in the three combo
boxes are changing the values of the CURRENT (usually the first) record in
the table before the button code has a chance to look anything up, and thus
before any "GoToRecord" or similar could be activated.

I see the reason this is happening is that the variables (for employee,
month, year) are the same in the related tables. Do I (can I) break the
relationships with employee, month and year tables? Or is there a better
way?

regards,
slowuptake
 
J

John Nurick

It sounds as if the first form is bound to the table containing the
timesheet records, and each of the three comboboxes are bound to the
relevant field in that table (i.e. the ControlSource of each combobox is
the field in question).

If it's set up that way, the values the user selects in the comboboxes
will be applied to the current record. But if all the comboboxes are
used for is to select employee, month and year in order to look up the
timesheet ID, they don't need to be bound to the table, just to have
their RowSource properties set to get the lists of employees, months and
years for the user to select from.
 
Top