update through vba new record, currently opened in a form -


i have question regarding updating new record through vba. first - assumptions. i've made form called "assortment", displays set of records , sobreport shows related invntory. i've put button on it: "add new record". opens second form "inventory_details" intended enter , view inventory spcific data. inventory of specific assortment type. - i've passed assortment_id inventory_details form through docmd.openform like:

    docmd.openform stformname, , , , acformadd, , me.assortment_id 

the data source of "inventory_details" form query contains assortment table joined inventory table inventory_id. best way add id passed openargs opened new record , refresh form show related assortment data? trying like:

    private sub form_open(cancel integer)         dim assortmentid integer         if (not isnull(me.openargs))             assortmentid = me.openargs()             set rst = me.recordset             rst.edit             rst.assortment_id_assortment = assortmentid             me.requery         end if     end sub 

but gives me error "3021 " no current record"...

here suggestions,

. make sure define variable rst

. check eof condition make sure recordset contains rows

if rst.eof     msgbox "the recordset empty." end if 

. why clone ms-access recordset?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -