Expand my Community achievements bar.

Prefill fields from a database

Avatar

Level 7

I have a form with a OLEDB connection and I have bound certain fields to it (name, address etc.). What I want to do is allow the user to put in their client number and then the form fills in the other information (name, address etc) from the database. How do I do this (in formcalc if possible)? Thanks!

5 Replies

Avatar

Level 7

OK so I have watched the video but I have multiple data connections and I am not sure how to link them together to get the one record? (ie. the client number is in one table of the database and then in a seperate table ( so new data connection) is the address and in a seperate table are other details I need to access).

Avatar

Former Community Member

A form can support one database connection, only. You will have to create a SQL statement to join the tables containing the client number and the address.

Steve

Avatar

Level 7

and how do I do that? That is the bit I need to know.

Avatar

Level 7

So I have now worked out the SQL bit and have a OLEDB connection with an SQL query which links the tables. It gives me the correct record for one client but what I now don't know is the code to put into the form so you can enter a client number and it will bring up that record. I have a client number numeric field and I assume the code goes in the exit event but can someone please help me with the actual code. Thanks!