I have a form with some textboxes comboboxes. On editing there is a combobox for selecting which user to edit. On selecting a user, i have managed to fetch all the records from the db. But now here the problem occurs -> There is a combox (say deptno) which is fetching only one dept no ofcourse for the selected user.

First Problem: Now i want is that the deptno combobox should have all the deptno's but the selected one should be the as per the selected user.

Second Problem: I have done something weird so the deptno is fetching the record of the selected user and the deptno next to it. So if i edit the users deptno from e.g 100 to 200 then the record is updating for 100 as well as 200.

Please help me in this i have wasted so many days as i am so new to coding.

Thanks in advance.

First Problem Solution : Select All deptno and then select the user specific dept no. and make it selected

Please post your code here, so i can check it out.

First, make a function to query all deptno form your database e.g "SELECT deptno FROM TABLE" and then put that function to load form. Second, your not going to update deptno because, i guesse in your database design deptno is a primaty key. I'm advising you that if your going to update a records, dont update the primary key, and please post your code sothat they can check.