Variable with Table Relation

Hey Gang… I am working with a form that is based on the Customer table in v2.60B. I create a variable “DeliverTo” and set a table relation under the properties as: “Ship-to Address”.Code WHERE (Customer No.=FIELD(No.)). When the lookup is hit, a Windows error messages is displayed that an illegal operation has been performed and the application is closed. If I remove the filter WHERE (Customer No.=FIELD(No.)), there is no error. If I change the filter to WHERE (Customer No.=CONST(1019))there is no error. Anyone have any thoughts? ------------------------------ Rick Acton High-Tech Consulting Services 301-662-0732 Edited by - goofyfish on 2001 Jul 18 14:34:06

I think u have changed Customers list form: added some code or maked this form editable … Check this …

The Customer List form is not being used… this is just a straightforward lookup. The form being used was built from “scratch”, and other lookups (Item, Customer Ledger Entry) work as they are supposed to. In testing, I added a field to the Customer table called “Deliver To” and set the table relation there; it works fine. I dunno… sounds “buggy” to me. ------------------------------- Rick Acton High-Tech Co Edited by - goofyfish on 2001 Jul 18 15:59:24

Sorry, i made mistake: i thought about customer addreses list form … :slight_smile:

Hi Rick, I tried the code on GB 2.60A and the problem is the same - system crashes. But you can do the following: Do not use property “Table relation” but put following code into “On lookup” trigger of the text box (I named the variable as gcodDeliverTo): OnLookup(VAR Text : Text[260]:wink: : Boolean lrecShipToAddress.SETRANGE(“Customer No.”, “No.”); IF FORM.RUNMODAL(0,lrecShipToAddress) = ACTION::LookupOK then gcodDeliverTo := lrecShipToAddress.Code; This works fine. Michal

Thanks for the help. The OnLookup() will do the trick! Rick