Search code examples
sqllivecyclelcds

Livecycle dynamic form with access data lookup?


I've read a few tutorials and tips on how to setup a data connection (ODBC) between a livecycle (PDF) form and an Access database, but these are all limited to searching through the records (in the access database) one by one or returning all of them. What i'm trying to achieve is a lookup by searching on a staff id number and then returning all the other information in that row. If this at all possible or anyone has any advice then that would be great, otherwise it's back to the drawing board.

Many thanks

Mark W


Solution

  • That's possible. You need to craft your select statement in LiveCycle Designer using Javascript.

    1) Set up an ODBC data source using a select statement. 2) Bind the result of the select statement to your form fields. 3) Create a field where the user can pass a database lookup id. 4) On that fields exit-event, use javascript to craft a new SELECT statement where you select one row given the lookup id. 5) Also using javascript, inject the new SELECT statement into your data source's query item. 6) Execute the SQL question on the data source you set up. 7) There is no step 6.

    More on 4), it's possible you have to clone the existing data source object before manipulating it (security reasons...).

    Here's what you want to do. Make sure you read the comments, as the cloning technique wasn't neccessary at the time the blog post was created:

    http://forms.stefcameron.com/2006/09/29/selecting-specific-database-records/