database - MS Access 2007 - OpenArgs not passing the value to next form? -
so pass id value 1 form next using
docmd.openform "secondform",,,,,, mainid docmd.close acform, "firstform", acsaveyes
and check value on second form's load event:
mainid = val(me.openargs)
and when debug , step through hover on , can see contains value
then have button click event on second form supposed repeat process, when run following
dim rs dao.recordset dim dbs dao.database set dbs = currentdb set myrs = dbs.openrecordset("tblmain") if myrs!mainid = mainid
after rs.edit, etc stuff....the routine not making far. once same debug , hover, value here empty. there missing because can see value on forms load event, once try use in action mia
thanks justin
sounds scope problem. mainid declared?
if declare within form open procedure, it's gone once procedure finishes.
consider changing button's click event procedure.
if myrs!mainid = val(me.openargs)
openargs doesn't "go away" after form load. don't see why need store openargs mainid variable. use val(me.openargs) using mainid variable.
alternatively, make mainid module level variable available form's procedures.
update: there situation might open form without feeding value openargs? if so, val(me.openargs) return 0. error condition in application's logic? should command button "clickable" (enabled) when openargs value has not been supplied?
Comments
Post a Comment