October 22, 200421 yr Newbies Hi! Database A (master file) is related to Database B. I want to write a script that will allow me to enter a customer number into DB A and then have the script validate/check that there is a related record in DB B. If there is a related record I want to continue entering data in DB A but if there is no related record then I want to be able to enter a new record in DB B then go back to DB A and continue entering data. Can anyone help me with some suggestions? Cheers
October 22, 200421 yr Validating the relationship is pretty easy, #From Database A If[ DatabaseB::CustomerID ] # There is a related record End If But this type of check isn't often used for entering new records. What is the data you are working with? Maybe there's a better process.
October 22, 200421 yr I want to write a script that will allow me to enter a customer number into DB A and then have the script validate/check that there is a related record in DB B. If [ IsEmpty(DatabaseB::CustomerNumber) ] ... boolean produces true (1) if there is no related record. If there is a related record I want to continue entering data in DB A but if there is no related record then I want to be able to enter a new record in DB B then go back to DB A and continue entering data. There is no need to jump to DatabaseB and create a record. Your relationship itself can do this for you. Turn on Allow Creation of Related. Place a field from Database B on your Database A layout (anything except the CustomerNumber. Let Users enter a value in it, and your related Database B will be automatically created if none exists matching that CustomerNumber. You can also just take care of this behind the scenes without placing a field from B on your A layout ... use script with the If[] test above. If true (no related record), use script to set any B field (except the CustomerNumber) and your related record will be created and the associated CustomerNumber will be automatically inserted in B for you.
Create an account or sign in to comment