Subform New Records

  • Thread starter Thread starter kerry
  • Start date Start date
K

kerry

My main form is called MMEHT_ShortTermDisabiltiy and my
subform is called Action_History. I have the two forms
connected by the Claim_ID field. My problem is that the
Action_History ID field isn't automatically filling in
when I start typing information into the main form. I've
even tried putting default values into a couple of the
fields to try and make it think that a new record needs
to be created in that table, but it's not working.

If anyone knows how to make it create a record in the
subform each time I create a new claim record in the main
table, please help. I'm thinking I may need some code,
but I'm not sure. I'm still in the learning phase.
 
My main form is called MMEHT_ShortTermDisabiltiy and my
subform is called Action_History. I have the two forms
connected by the Claim_ID field. My problem is that the
Action_History ID field isn't automatically filling in
when I start typing information into the main form.

Ummm... why would you expect it to be? There is no data in the
Action_History table; the ID is not created until you put some data
into the table.
I've
even tried putting default values into a couple of the
fields to try and make it think that a new record needs
to be created in that table, but it's not working.

A Default value - like an Autonumber - only takes effect when you
enter data into *something* in the record.
If anyone knows how to make it create a record in the
subform each time I create a new claim record in the main
table, please help. I'm thinking I may need some code,
but I'm not sure. I'm still in the learning phase.

You would need code (in the mainform's BeforeUpdate event for example)
to do this; but I must ask... why? What data are you storing in the
Action_History table that is not already in the main table?

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
I have one claim with many actions for that one claim.
That is why I created a different table for the Actions.

Do you know what code I would use? Would I use .AddNew?
 
I have one claim with many actions for that one claim.
That is why I created a different table for the Actions.

Do you know what code I would use? Would I use .AddNew?

Fine; you will get a new action record in the Actions table when (and
not before!) you enter data for the first action into the Actions
table. There is NO need to create an empty "placeholder" record in the
subform in order to do so, and in fact in my experience it's a bad
idea - such empty placeholder records have a way of never getting
filled in!


John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top