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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding multiple values to a subform

Status
Not open for further replies.

CaptainBob007

Programmer
Dec 20, 2003
42
US
I'm working on a system that references addresses to property numbers (PINs). A given address can have more than one property number, so I have a table of properties (tblProps) with primary key 'PropID', and a table of Property numbers (tblPins) with primary Key 'PIN' and the 'PropID' field as well to relate back to tblProps.

In my form to add properties, I'm trying to create a subform where I can type in one or more PINs (in a datasheet view preferably) and when I add the property, all the associated PINs will end up in tblPins.

I've done similar forms before, but all have involved adding pre-existing data, whereas the PINs dont exist anywhere in the database yet. Any advice on how to do this would be most appreciated!

~Bob
 
Bob

I like your design. I am going to assume you have created a relation between the two tables, address and PIN.

To enter your PIN's, the Address record has to exist. A typical way to do this is in a subform. I am going to assume you already have your address form, your main form already created.

Create a form based on the PIN table. Change it from a single form to a contineous form using the format tab in the property window for the selected form.

Drag and drop the PIN table on to the address form - position it per your needs.

With the property window still open, click on the main form, and then click on the subform, and move to the data tab. You can now link the main and sub forms using the parent / child forms. Assuming you are using AddressID as the primary key on AddressTbl, you will have AddressID on the PIN_Tbl as a foreign key. The AddressID is the field you would use to link the two.

Assuming everyting is correct, after you anter an Address record and update it, when you move to the subofrm, the linkage should be fairly automatic.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top