Edting a document based on a @DBLookup

Here’s my dilema!

I have a field on a form populated from a @DBLookup that contains contacts per company.

The field is populated by the contacts name and telephone number.

What I need to do is to be able to open this contact document in edit mode from purley what is in this field. Kind of a reverse lookup senario…

Is this possible?

If so how?

Christopher

Subject: Edting a document based on a @DBLookup

You can get document unique IDs as return values in DBlookup in R6. So store the UNIDs in the document and write a small script to open the required document to open the required document.

Otherwise the easiest way is to use an embedded view of the contacts instead of using a dblookup for values and storing it in the document.

Hope this helps…

Subject: Edting a document based on a @DBLookup

I like the embedded view answer already suggested.

If the contact name is unique within the company(which I doubt), use something like this:

@If (ContactName = “”; @Return (@Prompt([Ok]; “Note”; “some kind of error msg goes here…”));@Success);

REM {See if contact exists - if not, stop with errror};

Key := ContactName;

Server := @Subset(@DbName; 1);

View := “(vContactName)”;

ContactExists := @DbLookup( “” : “NoCache”; “” : “”; View; Key; 1 );

@If( @IsError(ContactExists) | ContactExists = “”;

@Return(@Prompt([Ok]; “Error”; @Char(10) + "Contact Name " + Key + " not defined " + @Char(10) + ContactExists));

@Success );

REM {display the Contact};

@Prompt( [Ok]; “Instructions”; @Char(10) + @Char(10) + “When done, close the Contact document to return to this Equipment document.” + @Char(10) );

@PostedCommand( [FileOpenDatabase]; “” : “”; View; Key; 1; 0 );

@PostedCommand( [EditDocument]; “1” );

@PostedCommand( [FileOpenDatabase]; “” : “”; View; Key; 1; 0 );

@PostedCommand( [FileCloseWindow] )

This was quickly adapted from a button I use. This will not work if your key is not unique. You MAY be able to make it unique by using CompanyName + ContactName. Just make sure that you do not allow duplicates.