Multivalued field in append query

robina

Access Developer
Local time
Today, 14:22
Joined
Feb 28, 2012
Messages
102
I am using Access 2007. I have an append query that adds a new class to a table named Class_catalog when the Save cmd button is clicked. I have now decided I need to make a field in this table a multi-valued field. The field is named Job_title. I have a form Class_New that lets you make selections and then click the save button to save to the Class_catalog table. On there form there is a combobox to choose Job_title. Now that I have changed this field to a multivalue field, I get an error when the append query is run. When the error occurs, this is the code that is the problem:

Code:
Private Sub CmdSave_Click()
    
    If Me.CboJtitle = "All" Then
    DoCmd.OpenQuery "New_Class_All_append"
    DoCmd.GoToRecord , , acNewRec
    Else: If Me.CboJtitle <> "All" Then DoCmd.OpenQuery "New_Class_Jtitle_append"
    
    DoCmd.GoToRecord , , acNewRec
    
        
    End If
    
        
End Sub

This is the SQL for the query "New_Class_All_append"
Code:
INSERT INTO Classes_taken ( Emp_ID, Class_ID )
SELECT Emp.Emp_ID, [Forms]![Class_New]![TxtCID] AS Class_ID
FROM Emp
WHERE ((([Forms]![Class_New]![CboJtitle])="All"));

The other query "New_Class_Jtitle_append" is this:
Code:
INSERT INTO Classes_taken ( Emp_ID, Class_ID )
SELECT Emp.Emp_ID, [Forms]![Class_New]![TxtCID] AS Class_ID
FROM Emp
WHERE ((([Forms]![Class_New]![CboJtitle])=[Emp]![Job_Title]))
GROUP BY Emp.Emp_ID, [Forms]![Class_New]![TxtCID];

I wouldn't ask, but I haven't worked with multivalued fields before. If there is a way without using it, I'm open to that as well.
Thank you!
 

Users who are viewing this thread

Back
Top Bottom