How to create a criteria like this??

M

Marco

Hi. I need to have a special criteria to my querie.

I have a Employees table, in that table I have this fields: (the type if
this fields are Yes/No)
- Manager
- Responsable
- Chief

One employee can be any of those, Manager and Chief; Responsable and Chief,
etc...

So, here is my problem. I a form, I have two combo box, one to choose the
type of employee and the other the mane of the employee.

What I want is, when I choose Manager in Combo box1, I want that appear in
combo box2 all managers, I mean, I users that has Yes on Manager field.

If I choose Chief, I want that in combo box2 appear all Chiefs, well, all
employees that was Yes the Chief field.

When I say Yes, I mean, has that field checked.

How can I do this??????

Please help me.

Best Regards,
Marco
 
J

Jeff Boyce

Marco

If I'm understanding your description, you have multiple fields that are
Yes/No and are used to indicate "type of employee". If so, then you have a
.... spreadsheet!

You won't get the best use of Access' relationally-oriented features and
functions if you feed it 'sheet data.

Are you saying that a given employee might be more than one of these
"types"? Do you have roles/positions and another category related to
"responsible"?

I'm having trouble visualizing your underlying data, which will be the
starting point for any queries, forms, reports, etc.

More info, please...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Dale Fye

Marco,

Agree with Jeff that if your employees can be characterized as more than one
"Type" then you need an EmployeeTypes table where you can enter the various
employee types.

I take it this is some sort of search form, since this will not work as a
data entry mechanism. If that assumption is correct, given the structure you
have, I would create 3 queries, all similiar to the following, but
substituting the appropriate field in the Where clause. Save each of these
queries (qry_EmpManagers, qry_EmpResponsible, qry_EmpChief).

SELECT Emp_ID, (Emp_LastName & ", " + EmpFirstName) as EmpName
FROM tbl_Employees
WHERE Manager = True

Now, in the AfterUpdate Event of the employee type combo box (cbo_EmpType)
put some code that changes the data source of the 2nd combo.

Private sub cbo_EmpType_AfterUpdate

if me.cbo_EmpType = 1 then 'Managers
me.cbo_Employees.RowSource = "qry_EmpManagers"
elseif me.cbo_EmpType = 2 then 'Responsable
me.cbo_Employees.RowSource = "qry_EmpResponsable"
elseif me.cbo_EmpType = 3 then 'Chief
me.cbo_Employees.RowSource = "qry_EmpChief"
else
me.cbo_Employees.RowSource = ""
endif

End Sub

HTH
Dale
 
M

Marco

Hello,

I don't that the way that I use to do that was not the best. The problem was
that at the beginning that start with one idea and than things grow up.

I think I get a way to make it work. check:
ALike (IIf(([forms]![38_form_Vistorias_Areas_Detalhes]![combo24])=2;Yes;'%'))

It's working. regards,
Marco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top