Adding a record in a subform -
05-24-2004
, 12:55 AM
Hi all,
How can I add a row in a subform from code? I have a form named
"papers" containing textboxes txt_papers_id, txt_papers_title,
txt_papers_location bound to corresponding fields in table1. A
subform keywords_subform contains textboxes txt_papers_id and
txt_keywords_id bound to columns in table2. A listbox list_keywords is
populated by column "keywords_id" from table3. Table1, table2 and
table3 have 1--M--1 relatiionship. When I double-click an item in
list_keywords, I find out whether the corresponding value
(keywords_id) is already present in the subform, and if it doesn't,
then insert a row in it. I am so far been able to search the subform
and determine whether the value exists in it or not by using the
creating a recordset object and assigning to it the
form.recordsetclone property of the subform. However, when I insert a
row in it, nothing happens to the subform. I think the new object is
just a copy of the subform's recordset, not its reference. It may be
simple, but I don't know how to insert a row by using code. I can use
SQL INSERT, but don't want to add the record directly to the table and
istead want to use the form to handle it.
Any suggestion is appreciated.
rrk |