Adding a Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a bunch of forms that are all linked to their own tables, and I have
buttons navigating between the forms. Each form, when opened, brings in the
ID number and Date from a Master form that stays open the whole time. All of
this works fine. The problem is, when I don't have any data to input into a
form, no record is created in that forms table. I would like for a record to
be created with the ID number and Date that it pulled from the Master form.
Can anyone help me?
 
I think you're going to have to do that with code.

There are a couple of different approaches you can use. The easiest thing
might be that when you create a new record on the master, you use the after
insert event to create new records in each of the tables. Then when you go
to any specific table/form, you filter the form to only show the record that
was just added.
 
I have a bunch of forms that are all linked to their own tables, and I have
buttons navigating between the forms. Each form, when opened, brings in the
ID number and Date from a Master form that stays open the whole time. All of
this works fine. The problem is, when I don't have any data to input into a
form, no record is created in that forms table. I would like for a record to
be created with the ID number and Date that it pulled from the Master form.
Can anyone help me?

Creating empty "placeholder" records in related tables is VERY rarely
appropriate. They have a nasty way of never getting filled in! If you
have no data, I would suggest that you should have no record.

You will be able to meet the *need* by changing the way your forms are
set up. Could you consider having a mainform based on the master
table, with a Tab Control, with a Subform on each page of the tab
control? Rather than opening a separate form for each related table,
the Subform will display and synchronize the data automatically.

If you really prefer the separate-forms approach, I'd suggest passing
the ID and Date in the OpenArgs parameter of the OpenForm event and
setting the Default property of the appropriate fields, in the second
form's Open event.

John W. Vinson[MVP]
 
Back
Top