I am trying to insert data into a table based on user input into a combo box (whenever the user types in something not in the list, it adds that value to the underlying table), using the following SQL syntax:
INSERT INTO TableName (PrimaryKey)
VALUES ([Forms]![Formname]!cmbComboBoxName);
Whenever I run it, I get a primary key violation--but if I replace ([Forms]![Formname]!cmbComboBoxName) with the same value that is in the box (in quoation marks), it works fine. A select statement works correctly using ([Forms]![Formname]!cmbComboBoxName)--but if I remove the key restriction from the table, the insert statement inserts blank records--so evidently the problem is with referencing the combo box text.
Any assistance would be greatly appreciated.
INSERT INTO TableName (PrimaryKey)
VALUES ([Forms]![Formname]!cmbComboBoxName);
Whenever I run it, I get a primary key violation--but if I replace ([Forms]![Formname]!cmbComboBoxName) with the same value that is in the box (in quoation marks), it works fine. A select statement works correctly using ([Forms]![Formname]!cmbComboBoxName)--but if I remove the key restriction from the table, the insert statement inserts blank records--so evidently the problem is with referencing the combo box text.
Any assistance would be greatly appreciated.