Running Update Query from Combo Selection

S

Scott A

I'm trying to get a combo box to execute an append query to add records to my
database. My problem is not all of the relevant information is displayed on
the current form (or subform), and I don't know how to limit or filter the
query properly.

I've got a form for editing document information, which includes a subform
that assigns the document to a collection. On another form, the collections
are assigned to employees.

There are three tables which include primary information for each entity:

tblDocuments (DocumentID)
tblCollections (CollectionID)
tblEmployees (EmpID)

and three tables which manage the relationships between them:

tblDistributions (CollectionID, DocumentID) 1:Many
tblAssignments (CollectionID, EmployeeID) 1:Many
tblDocTraining (EmployeeID, DocumentID) 1:Many

When a user on the form (based on tblDocuments) adds the document to a
collection (subform based on tblDistributions), I would like to add a MsgBox
which gives the user the option to add records to tblDocTraining. The records
added to the table should only include employees who are currently assigned
to the collection in tblAssignments.

I'm struggling with how to limit the query - something like...

strSql =
INSERT INTO tblDocTraining ( DocumentID, EmployeeID )
SELECT (value in combo box) AS DocumentID, EmployeeID(?)
FROM (tblEmployees INNER JOIN tblAssignments ON tblEMployees.EmployeeID =
tblAssignments.EmployeeID
WHERE... (something that tells it to get only the employees who are
currently assigned to the designated collection?)

Anyhow, I'm quite lost and would love to hear your suggestions.

Many thanks!
Scott A
 

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