Linking Forms from Different Tables with ID

  • Thread starter Thread starter Nadine
  • Start date Start date
N

Nadine

Hello! I have created a database with several linked
tables with an ID variable as the primary key (autonumber)
and then a matching ID variable on the other tables as a
number key (one to many relationship). I am now trying to
create forms linked through this ID variable, so that one
form will automatically bring up another with the correct
ID variable already in place. I would prefer not to use
subforms because of the size and because that would mean
that there would be too many subforms on one form. No
linking methods I have tried, however, have been
successful - I always get the error message that a related
field is required in my main table (with the primary key)
to add data. How do I get the buttons to link correctly,
so that I can add new data and still keep the forms
linked? I hope this makes sense - this has been plauging
me for days and any help would be very greatly
appreciated!!
 
Hi Nadine:
Without knowing how your forms are set up, it's hard
to say what your layout should be. Are there queries
behind your forms? Those would be the place to start. If
you cannot add a new record to your query, then you will
have to play around with the relationships until you can.

If you are not using queries and simply have the table as
a recordsource for the form, then you need to look at
which fields are on which form.

Hope this helps sort things out a bit.
 
Hi Art,
No queries behind the forms - just the tables. One form
has the info from one table and the other linked forms
have the info from other tables. Basically, there is no
overlap between fields - should there be?
Thanks!!!!
 
Basically, access is trying to get you to link the forms
as a main/subform combination even though you don't want
to. It wants a field from both tables on the main form so
that it can associate the ID with the PK in the second
table. Child/Master fields just like a subform. If you
don't want to use a subform, you might try using a query
that combines the two tables. Then you could add fields to
the appropriate form and get what you want. Take note,
though, that the relationship between the tables has to be
adhered to. Otherwise you won't be able to add records to
the child table because there will be no corresponding ID
in the master table.

Hope This Helps
 
I hesitate to reply because I am not very very
knowledgable but this sounds like what I was trying to
do. I have main form with a "MainFormID". I open another
form(subform) with a command button. The subform includes
the "MainFormID" field. I opened the subform with
criteria to link to the main form
(DoCmd.OpenForm "frmSubformName", , , "MainFormID =" &
Me.MainFormID). The form linked but would not allow
record entries. I added Me.MainFormID = Forms!
frmMainForm.MainFormID in the subform's Load Event
property which puts the number from the main form's ID
field into the subform's "MainFormID" field and it seems
to be working fine.
For more info see post "forms not linking" on Feb 21 2004
5:28 PM.
Good Luck !
Walter
 
Back
Top