G
Guest
I have a table called tblMemberData, which has an autonumber/primary field
called “ID†and several other fields. A second table, called tblDirections,
has two fields, ID (number) and Directions (memo field).
I have established a one-to-many relationship between tblMemberData and
tblDirections based on the ID field.
I have a form based on the first table, with all the fields visable.
I have a second form (“frmDirectionsâ€), based on the second table, with the
two fields showing (I have the ID field showing just for testing purposes
now).
On the first form, I have a button with the following “on click†event
procedure (some lines are left out to conserve space here):
stDocName = "frmDirections"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
If I have the main form open to the record with, say an ID field of 2 and I
click the button to open the directions form, the form opens, but it shows
“0†in the ID field. When I try to close the form after adding some data I
get the following error: “You cannot add or change a record because a related
record is required in the table “tblMemberData.â€
I know it’s simple, but what did I leave out?
called “ID†and several other fields. A second table, called tblDirections,
has two fields, ID (number) and Directions (memo field).
I have established a one-to-many relationship between tblMemberData and
tblDirections based on the ID field.
I have a form based on the first table, with all the fields visable.
I have a second form (“frmDirectionsâ€), based on the second table, with the
two fields showing (I have the ID field showing just for testing purposes
now).
On the first form, I have a button with the following “on click†event
procedure (some lines are left out to conserve space here):
stDocName = "frmDirections"
stLinkCriteria = "[ID]=" & Me![ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
If I have the main form open to the record with, say an ID field of 2 and I
click the button to open the directions form, the form opens, but it shows
“0†in the ID field. When I try to close the form after adding some data I
get the following error: “You cannot add or change a record because a related
record is required in the table “tblMemberData.â€
I know it’s simple, but what did I leave out?