>I tried your code and most of it worked for me. Here is my SQL:
>SELECT USERS.Last_name,USERS.First_name,USERS.User_id;
> FROM INVENTORY!USERS USERS;
> ORDER BY USERS.Last_name,USERS.First_name;
> INTO CURSOR MyCursor
>
>It works right by bringing up the list of users (last name, first name, and id) in alphabetical order, and it is searchable. My problem is when I first pull up the record, the combo box displays the last name, not the user_id. Also after picking one of the records, it puts the last name in the field. I have the controlsource set to computers.user_id and the boundcolumn is set to 3.
>
>This shouldn't be this difficult. Is there an easier way to populate a field with information from another database?
Van,
If you think it's difficult you have seen nothing yet :) If you want to see say last_name+first_name then change sql to :
SELECT padr(trim(Last_name)+" "+trim(First_name),30," "), ;
User_id ;
FROM INVENTORY!USERS ;
ORDER BY Last_name,First_name ;
INTO CURSOR MyCursor
Now it would show last+firstname and you could do an incremental search on it (boundcolumn is now 2). Name would be shown but id would be returned to you. If you want to see id in combo then it means it would be the first column and you could only search on it. This is a downside of combo. There are solutions.
Show the id in label (named "label1"):
ThisForm.Label1.caption = this.list(this.listindex,2)
dodefault()
ThisForm.Label1.caption = this.list(this.listindex,2)
Or you could show id by just including another textbox with controlsource = users.user_id and refresh if accordingly.
Or instead of combo you could use a grid control (I'm sure you would skip this for the moment).
Or you could get the id from a called form (Called form has either a combo or searchable, sortable grid-my preference).
PS: Please note that the SQL is rowsource (not a separate SQL). But it's your choice :)
Cetin