Inserting data into database
I doing a project on online exam. There are two tables question table and subject table(Access database). In the subject table there are two fields sub_id and sub_name. In the question table there is sub_id field. In the dataentry screen there is a combo box of subject name. I want that while data entry when the user selects the subject name from the combobox the corresponding subject id should be entered in the question table.
I will be thankful if some one could suggest some code to solve the above query.
Re: Inserting data into database
Try this using a recordset
INSERT INTO QUESTIONS (SUBJECT_ID)
VALUES (
SELECT SUBJECT_ID FROM SUBJECTS
WHERE SUBJECT NAME = '<subject_name>');
Hope this helps
Andrew