Using VB to search multiple criteria in subforms/Using ADO code.

J

Justin Walters

Overview:

I'm trying to build a data entry form to enter employee timecards. I have 2
tables linked by employee ID, [Employee] and [timesheet]. Timesheet is also
linked to a [week] table which keeps track of our fiscal weeks in order to
identify a time entry under [timesheet] to the appropriate pay week. So the
[timesheet] table keeps track of [employee id], [week id], [date], and time
entries for the day.


Issue:

I'm trying to build a form with combo boxes to select the week and employee.
The main form is currently linked to no tables. I have a subform for each
day of the week. After the employee is selected, I need the form to search
current records under each subform and see if it finds an entry for that
particular day for the selected employee, else the subform will load defaults
established by VB code. The first day is identified by the [start_date]
under the table [week] and each day thereafter is identified by
[start_date]+1,+2,etc...

Ideally, I don't want any entries saved without the user selecting a save
button. Under the current structure with subforms, however, it isn't
possible, since Access automatically saves a record when a subform is exited.
The only way I can see to do this is remove the subforms and have the main
form unlinked to a table. I would then create a command button with ADODB
Visual Basic code to save the unbound controls to the [timesheet] table.
However, the ADO code would also have to search the [timesheet] table after
an employee is selected to see if an entry already exists and display it for
that day. It would also need to take into consideration to add a new record
or modify an existing record when saving. I'd only call myself intermediate
with VB coding and without some guidance, ADO is above my head.

Basically,
I'm starting from ground-zero again and I'm welcome to any ideas. Here is
what I need:

- a form that can have 7 days of entry on the same page, one for each day of
the week
- the form searchs existing records by employee and date worked, and pulls
up that day for modifying. If no record is found, it loads defaults
established in VB for the user to adjust and create a new record.
- I don't want any record saved without the user selecting a button to do so
(This is a desire. I'd put up with each day saving after leaving that day).


Thanks for reading this post. I appreciate any assistance!

Justin
(e-mail address removed)
 

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