name not displaying in subform

K

Kyle

I have a database that tracks emergency contacts for freezers at our
school, and have a problem with how those contacts are being displayed
- or NOT displayed - in a subform. I don't even know where to begin to
look for the problem, and hoping someone may know where I can start.

I have three tables associated with the problem: the primary table
containing information on the freezers including the primary
investigator whose freezer it is, a secondary table of employee contact
information, and another secondary table where the employees and
freezers are linked since an employee can be a contact for many
freezers and each freezer has four contacts.

I have a form set up for entry and updating of the data that includes a
subform which displays data from a query designed to show only the
contacts listed for that particular freezer unit.

So, here's the hinky part: occasionally, a person listed as a contact
for a freezer will disappear from the subform. I select their name from
the combo box (we have a limited number of employees who are listed),
CTRL-Tab off the subform, and their information is still there. But if
I go to the previous record on the form, then come back, the person is
no longer displayed on the subform...but they are still there, because
if I try to select their name from the list again and CTRL-Tab out, I
get an error message saying that record already exists for this
freezer.

This doesn't happen all the time, and I cannot find a common
characteristic among the employee records that would appear to me to
trigger this. This also happens whether there are no existing contacts
listed or one or two listed. It also happens not just on entry of new
contacts, but has been happening on existing records.

Any suggestions on what I've missed, what could be causing this, what I
should do?

Thanks!
 
K

Kyle

UPDATE: I have noticed that the employees that won't show in the
subform will magically reappear if another employee is added as a
contact. Conversely, with these same problematic employee entries, if a
second contact is removed, the subform will not display the sole
(problem) contact.
 
K

Kyle

SOLVED!

OK, so I found the problem - a SQL statement written by an earlier
worker-bee on the database was written thus:
In (SELECT [UnitID] FROM [tblFreezerContacts] As Tmp GROUP BY [UnitID]
HAVING Count(*)>1 )

So if a unit had only one contact rather than the needed 3-4, the query
would not see it.

I changed the statement to In (SELECT [UnitID] FROM
[tblFreezerContacts] As Tmp GROUP BY [UnitID] HAVING Count(*)>=1 ) and
it's fine!
 

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