Plz Help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have this query which I used to populated a dropdown list when a department
is assigned to a employee.now I want to populated those department which are
not assigned to employee.this query not work.

select Dep.Department_Name,emp.dept_id from contact_dept
Dep,Contact_Employee_Depts Emp where dep.active=-1 and dep.Dept_id <>
Emp.Dept_Id and Emp.Emp_id=" & CLng(ViewState("Emp_id")) & ";"

if i put = in istead of <> it also give same resualt
 
amjad said:
I have this query which I used to populated a dropdown list when a
department
is assigned to a employee.now I want to populated those department which
are
not assigned to employee.this query not work.

select Dep.Department_Name,emp.dept_id from contact_dept
Dep,Contact_Employee_Depts Emp where dep.active=-1 and dep.Dept_id <>
Emp.Dept_Id and Emp.Emp_id=" & CLng(ViewState("Emp_id")) & ";"

if i put = in istead of <> it also give same resualt

It sounds like you have a combo box on a form
and you want to change its RowSource.

In Form Design View, open Properties of combo box.

Find "RowSource" and click on line.

A small box with 3 periods should appear
next to this property row.

Click on that small box which should open
up query designer.

My guess is that it shows 2 tables...
"Emp" and "Dep"?

If you have any line(s) connecting them,
right-mouse click on them and choose
Delete.

Now create a new link by
Drag-and-drop a field from one table
(dept_id?) to field in other table (dept_id?)

Right-mouse click on this line and
choose "Properties"

Select option button that shows all Dep
and any matching Emp. Close.

Your line should now have an arrow
pointing toward Emp table.

I believe show Dep.Department_Name
and Emp.dept_id in grid. If not, drag
them down to grid.

In "Criteria" row under column for dept_id,
type in

IS NULL

Just to test, click on "View/Datasheet View"
in upper toolbar.

It should show all departments that do not
have an employee assigned to them.

If that is what you want, click on "X" button
to close query designer.
 
no under stand wrong and i got it soltion from code project with in 30 min
i am using asp.net(vb language) to populate combo box and use qury like that
to populate it.thanks for ur rply
 
Back
Top