AnsweredAssumed Answered

How to address a desired record in a different table?

Question asked by serval on Sep 27, 2015
Latest reply on Sep 28, 2015 by serval

I have two tables with their own layouts: Invoice (for billing), and Locations (a list of locations where work is performed).


Normally, I click a Location button on the Invoice layout, and a script takes me to the Locations layout, where I pick the location. I click on that Location’s This_One button, and the name, address, etc. of that Location is copied into the script, the layout switches back to the Invoice, and the copied location data entered into the Invoice layout.


That all is working fine.


Now I want to mark one of the locations as the Default Location so that when I create a New Invoice, the default location is automatically entered.


I have the marking of the Location working:

I have Auto-Entered Serial Numbers as a key field for Location.

A checkbox on the Location layout indicates which Location is to be the default, and the serial number of the checked Location is stored in a Global variable, DefaultLocation.


My final problem, where I am stuck, is how does the New Invoice script operate on the correct Location record? I have the Serial Number of the Location record I want in that DefaultLocation Global variable, but how does the New Invoice use that to target the correct Location record? Everything I have tried so far gets data from the wrong Location record.