Can't programatically access the field that links two tables

From: Rich_L (rich_l_at_sbcglobal.net)
Date: 02/27/04


Date: Fri, 27 Feb 2004 11:41:10 -0800

I have two tables in a one-to-many relationship. I want to add a record to the "many" side, and update the related "one" side. For example, let's say the "one" table is named OneTable, and the "many" side table is named ManyTable; and the fields that link the tables are called OneLink and ManyLink, respectively.

This works fine when I do it using Data*** view or Forms view, but I can't do it programatically. First, I issue a DoCmd to add a new record. Then, I start putting the data into the fields of the new record in the ManyTable. But, I can't access the field ManyLink. Processing simply stops at the VB code line when I try to put a value into the ManyLink field, with no error message. I've tried referencing this field as ManyLink, ManyTable.ManyLink, and Tables!ManyTable.ManyLink. In the VB Immediate window, I can display the values (?fieldname) in all fields of the new record, except ManyLink.

In Data*** and Forms view, I am doing exactly the same thing, and it works OK. As soon as I put a value into ManyLink, the row expands to show the data in the associated OneTable.

How do I programatically put a value in the ManyLink field? e.g., how do I refer to this field in a VB statement?