Requery Combo Box

M

Marshall Barton

Michelle said:
I think I found my problem (one of many I guess). The code below will
automatically add all “Employee Names” to my Trainer box.

SELECT [Employee Names].[Employee Name] FROM [Employee Names] ORDER BY
[Employee Names].[Employee Name];

When I tried adding WHERE [Square 4] it removed all names. You asked me to
look at my query and you were right, I did not have “Square 4” in the
Employee Names table. I have a subform that contains “Square 4”. The name
of my subform table is “Employee Info” and the Employee Name is “Employee”.
I think this is where my troubles begin. Square 4 is called “Square 4” in
the Employee Info table.

I tried adding this code but it still clears out all the names.

SELECT [Employee Names].[Employee Name], [Employee Info].[Square 4] FROM
[Employee Names] INNER JOIN [Employee Info] ON ([Employee Names].[Employee
ID] = [Employee Info].[Employee ID]) AND ([Employee Names].[Employee Name] =
[Employee Info].Employee);


You may be confusing yourself by thinking about forms and
what they display when we're trying to get a query to
retrieve the desired data. In a database, all issues start
with the Tables, their Fields and the relationships between
the tables. Once you have well normalized table designs,
then you can work on the queries that retrieve the data
needed for other operations. With the right query working
as needed, then, and only then, can you create a form/report
to display the data.

With that strategy in mind, I think I am detecting an
anomaly in your table design. It appears that you have the
employee name in two different tables, which in turn implies
that there is a normalization problem. If my perception is
correct, then you need to think about it and decide if you
really have a valid reason to violate the rules of
normalization.

There must be something more to this than just having the
name in two tables, because your query with the Join should
work (unless the names are not really the same in both
tables).

With all that background, I think we need to review the
design of the tables (not the forms or combo box) involved
in the situation we are trying to address. Piecing together
the bits of information in your posts, I think we have at
least these tables under discussion:

Employee Names
Employee ID AutoNumber (Primary Key)
Employee Name Text (full name)

Employee Info
? ? ? ? (Primary Key)
Employee ID Long (Foreign Key)
Employee Text (full name)
Square 1 YesNo
Square 2 YesNo
Square 3 YesNo
Square 4 YesNo

Please add any additional tables and fields that are
important to the specific issues we are trying to deal with.
Then, we can create an appropriate query for the combo box
(assuming the forms are based on the right tables).
 

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