Jump to content

adding to a related table via script


ljm
 Share

This topic is 5761 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have two tables: Contacts; Addresses

When I am adding a new record on a layout from the contact table, I'd like to just tab into some fields from the addresses table. I thought I could use fields from both tables on a single layout, however it isn't working. Is there anything I could do to make an easy and painless data entry process? I could add a button/script that adds an address record, but then I'd have to jump to a new layout. Any suggestions are welcome.

Thanks

Link to comment
Share on other sites

It's not clear from your description what your structure is. If you're just having a single address for each contact, why not just add the fields to the contact table? I ask this because that would be the model I would imagine for the type of input you describe.

If, however, you are assigning each contact to an address, but each address might have multiple contacts (this certainly makes sense), then you will have to deal with the following situation:

1) Contact A gets set up with Address 1.

2) Contact B also uses Address 1.

Using the input model you describe will not work, since each time you create a new contact record and follow it with fields in the Addresses table, you will create a new Address record (with mucho duplication!). Or, in other words, how would your user get Address 1 hooked up with Contact B?

Other approaches include:

* figure out how to allow your users to search the addresses and use one if it's there,

* turn the input around, so you're creating addresses and adding contacts to them

* pre-create your address records, and set up contacts to select the address info from a dropdown list (assigning an AddressID to each contact)

Not included in any of this is the possibility of having people with multiple addresses; this would require a join table.

See if that gets you moving forward...

David

Link to comment
Share on other sites

"I could add a button/script that adds an address record, but then I'd have to jump to a new layout."

This is an incorrect assumption.

There are several ways to do this, some not necessarily requiring a layout jump. If the Address record relationship has "Allow creation of related records" turned on, you don't need a script at all.

You can also set up a relation to a global field, in which autocreation of related records is turned on, tie the global to the automatic primary key field of the Address table. Have the first script step set the global field to empty, then set one of the fields in the Address record. This causes the record to be created and captures the primary key value in the global.

Link to comment
Share on other sites

Thank you for all the feedback. This is a situation where a single contact may have multiple addresses associated with them. I have checked on the allow record creation setting and it is checked, but I am wondering if this might have something to do with using the file via remote access. A small number of people share the file and it seems that the non-host users have the problem, but I have to look into it more thoroughly when I work on it again next week. I'll post an update next week if I learn anything useful.

Link to comment
Share on other sites

This topic is 5761 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.