How to have two subforms on one main form reference same table??

  • Thread starter Thread starter tlyczko
  • Start date Start date
T

tlyczko

I have a main form with 2 subforms, each subform references different
data in the same table.

How do I make sure each subform only creates NEW records in the
referenced table and do not overwrite or change data in previously
created rows??

Otherwise I have to use two different tables, with similar kinds of
data, for each subform, which may well be the way to go even though
it's not really normalized, to make the data entry easier and simpler
for the end user.

Any code or MDB examples or website references would be very helpful,
thank you!

Thank you, Tom
 
Tom,

Yeah, if you get into edits, you'll get into write conflicts, and that
will be a headache.

Every form has a set of properties that controls what data is seen and
how it can be maniputlated. On the Data tab of the form's property
sheet, check out
Allow Filters,
Allow Edits,
Allow Deletions,
Allow Additions, and the less obvious
Data Entry, which will make your form _not_ show existing records, only
showing new ones you've added that session.

Jeremy
 
Hello everyone, one subform just shows one single field that is
auto-updated in the AfterUpdate event of one control on the main form,
this is just for user feedback, and the second subform is for adding
records to the table that the end user has to decide what to put in.

The two subforms are *diffferent* and expose different table data
relevant to their particular purpose, therefore changing the source
object on the fly won't work...

I solved the problem by setting up the underlying query of each subform
to show only the records matching the relevant criteria (is is a
program or record audit??)...

My initial testing shows that it works, I probably could do the same
thing with a different filter in each subform.

Thank you, Tom

P.S. Metrix looks nice from what little I saw of it, I will recommend
it for evaluation if the subject ever comes up here at work.
 
The two subforms are *diffferent* and expose different table data
relevant to their particular purpose, therefore changing the source
object on the fly won't work...

i'm glad you got a solution working that suits you, Tom. just as a fyi,
there's no reason why changing the source object of the subform control on
the fly wouldn't work - unless the user needs to see both subforms *at the
same time*. note here that we're talking about the SourceObject property of
the subform control, NOT the RecordSource property of a subform. you can
change the SourceObject property easily whether the actual subforms are the
same, similar, or completely different, and whether or not each subform is
bound to the same table or to completely different tables.

hth
 
Back
Top