Enter a date on Main form to populate 2 subforms

G

goeppngr

I have a main form with two continous subforms. Both of these subforms have
a date field. I would like to make it to where the user can just enter the
date on the main form and have it automaticly populate the two date fields on
the continuous subforms. What is the best way to approach this?

Thanks.
 
H

HiTechCoach via AccessMonster.com

If the records already exist in the sub forms, then I would use the "after
update" event of control on the main for where the date..is entered. In the
event you can use VBA code to build the SQL for two update queires (one ofr
each sub form's table) and then "Execute" each. You will propably need to
"requery" each of the sub forms to show the changes.
 
J

John Vinson

I have a main form with two continous subforms. Both of these subforms have
a date field. I would like to make it to where the user can just enter the
date on the main form and have it automaticly populate the two date fields on
the continuous subforms. What is the best way to approach this?

Thanks.

Probably Not To Do So... <g>

Are you storing the same date redundantly in three tables? If so, why?

If you do want to add the date to *new* records on the subform (rather
than updating an existing date field, which would need two update
queries), simply include the date field in the Master/Child Link Field
properties of the two subforms.

John W. Vinson[MVP]
 
G

goeppngr via AccessMonster.com

In the two subforms I need the production information tied to a date. The
reason I have two forms is because the two production areas are different so
I put the data in different tables. Is this a bad idea?

The main form at this point is unbound. I just want to keep the date in the
two other tables, but want my operator to be able to enter the data all on
one form.

Is there a way to not use two forms for this sort of thing with two different
tables? I would need to tie various text boxes to a different table, and the
date field to both.

tg
 
L

Larry Linson

goeppngr via AccessMonster.com said:
In the two subforms I need the production
information tied to a date. The reason I
have two forms is because the two produc-
tion areas are different so I put the data
in different tables. Is this a bad idea?

Almost certainly: A Very Bad Idea.

Put the identical data in the same table, and add a field to identify the
production area. Then you can have just one form, no subform needed, put the
date in the Form header in an unbound Text Box and copy it into the date
field in each record when you create the new record. But bind the form to
the Table/Query, and learn the way Access works because in the long run, it
will save you untold hours of time and untold amounts of grief.

Larry Linson
Microsoft Access MVP
 
J

John Vinson

In the two subforms I need the production information tied to a date. The
reason I have two forms is because the two production areas are different so
I put the data in different tables. Is this a bad idea?

Without knowing anything about the nature of your business or the
structure of the tables, all I can say is I Don't Know. It is very
likely the correct approach though, if the *STRUCTURE* of the tables
is different; if the two tables have the same fields, then you'll
really do better to have one table with an Area field to distinguish
which record belongs to which area.
The main form at this point is unbound. I just want to keep the date in the
two other tables, but want my operator to be able to enter the data all on
one form.

Then try setting the Master Link Field property of each subform to the
name of the unbound date textbox (that won't be on the list of wizard
choices, but you can just type it in); and the Child Link Field to the
name of the table field in which you want the date stored.

John W. Vinson[MVP]
 

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