I see two issues, the nuts and bolts of what you are trying to do and whether you should be copying names into these fields in the first place.
Nuts and Bolts:
Set field should do the job. If you are getting an error message that the field is not related, you'll need to look at your relationships and your layout design to figure out why this is the case. Copy and paste is not a method I recommend for this process. Copy and Paste have limitations that can cause problems in the future that set field, and set variable steps can avoid for you.
Should you try to do this?
Instead of entering names, enter an ID number from the customer table. If you establish a relationship linking the two tables by this ID number, you can simply add the related name fields to your layout and you'll see the names from the matching record in your cutomer DB appear.
You do this by:
Get the ID number for a given name from your customer table--this should be defined as an auto-entered serial number in the customer table.
Enter this ID number into a new record in your related table.
The above steps can be done with a drop down list or with a script.
Thanks for your reply, Phil. I see where you're coming from, but the idea of getting the customerID from the customer table doesn't work so well for me because I'm trying to make the process as streamlined as possible. That means that I want the customer table to be populated exclusively from the main form (lets call it the invoice form). The customer table itself is meant to be a backend for bringing up address matches. The end-user shouldn't access it directly via any layout. Therefore there can't be a relationship between the invoice record being made and the new customer, because the customer record itself doesn't exist yet.
The reason I want all customers to be chosen from the value lists is to avoid duplicates in the customer table.
I guess one possible solution is in the form of the following script:
---> Go to layout [customers] ---> New record ---> Copy CustomerID (serial) ---> Go to layout [invoice] ---> Paste into 'invisible' CustomerID field (thus establishing relationship) ---> Go to layout [customers] ---> Custom dialog with first and second name inputs ---> Set first and second names fields using relationship established by CustomerID
Is this a crazy convoluted way of getting where I want to be? All I really want to be able to do is make new records in a related table and then have those fields entered into the related table be pre-populated on the original form. Thanks for all your help :-)
I think you should think about your design. You say: "The end-user shouldn't access it directly via any layout." Yet the method you describe at the end of your last post accesses this table and modifies it exactly as though the user had typed the information directly into this table. Thus, why not place these fields directly on the layout? You can place fields on a layout, but still retain control over whether a user may modify the contents of those fields or not.
In either case, I strongly recommend that you not use the script steps Copy and Paste in this fashion. There are better ways to do this by passing the information as a parameter or by storing the information in global fields or variables and then using the set field step.
Problems with copy/paste:
If the referenced field is not present on the current layout, these steps fail silently--no error message pops up and the script continues to execute, but the copy or paste action doesn't happen.
If the user has copied information to the clipboard, a copy step will replace that data with the data your script copies and this will annoy and confuse your users.