Access Updating the Subform with Item selected in Listbox -
i have following code following: 1. delete data view table 2. appends data main main table 3. selects id & product nr of appended record , populates in view table 4. clears controls on main form 5. refreshes form
note: id listbox rowsource select id query view table. subform populates when click on id listbox. prompt subform populate once id box populated.
problem: after appending record, id listbox populates, selects item, subform (which linked through master - child) not requery record data id nr selected in listbox.
private sub cmdinsert_click() dim ctl control docmd.setwarnings (warningsoff) currentdb.execute "delete ec_id_table" docmd.openquery ("ec_insert_new_record") docmd.openquery ("ec_id_table qry") each ctl in form_frmec.controls select case ctl.controltype case actextbox if ctl.name <> "id" ctl.value = "" end if case acoptiongroup, accombobox, aclistbox ctl.value = null case accheckbox ctl.value = false end select next docmd.setwarnings (warningson) msgbox "insert complete!" me.form.refresh me.id.selected(0) = true end sub
thank you!
try refreshing subform. think goes this:
forms!mainform!subform1.form.refresh
(changing name of mainform , subform1 applicable).
otherwise, try rebuilding recordsource:
forms!mainform!subform1.form.recordsource = "select * mytable"
Comments
Post a Comment