Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linked forms: I can't add records to the subform

Status
Not open for further replies.

Abi1

Technical User
Jul 4, 2001
19
GB
I have two linked forms - one is launched from a button in the first. The forms are based on two tables which are linked in a one-to-many relationship.
When the second form is launched, it displays filtered information based on the primary key number of record that was being used (I got the VBA code from the forms wizard).
I can't add new records in the second form - an error message appears saying that some data is required in the main table. I need the form to automatically fill in the foreign key to be the same as the primary key (this is the link between the tables) when a new record is created.

Does anyone know what is going wrong?

Abi
 
I've solved this now, with a DLookup and an add button.
 
.
Glad you fixed it. This is what I came across...

I was trying to add a new record in the main form by filling two text boxes with default data. When I tried to add the first record in the subform, I was informed that there had to be a related record in the table underlying the main form.

The main form would not save a record from the default data, until I waited to populate one of the text boxes (a date) upon the On enter event.

More ways than one to skin a cat.
:) Gus Brunston
An old PICKer
padregus@home.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top