vba - Weird Error: Hit ENTER key in listbox, get NULL error for bound recordset values -


access 2007 adp/ade.

i have modal bound table. modal has single listbox control, , 2 buttons. 1 executes subroutine of code access values bound recordset, other closes modal.

two methods of use:

  1. select value in listbox, , click on button execute subroutine, works fine.

  2. select value in listbox , hit enter key on keyboard twice, attempts execute same subroutine, throws null error first time tries access value bound record.

so using method 1, value me.recordnumber return 12345. using method 2, null , error out. interestingly enough, selected value in listbox available using either method.

not critical bug, annoying. have teach folks click buttons rather use enter key on particular modal. has seen before? idea why values bound recordset unavailable using method #2?

edit clarification: error appears independent of particular piece of vba code. i've created new modal, bound different table, , tried access random datacolumn on recordset. same result.

here snippet error appears. errors out when attempting grab recordtype, value never null.

private sub cmdaddfromtemplate_click() on error goto err_myerrorhandler  dim mytemplatename string dim mydepartment string    dim integer  'did provide valid template name? if me.listtemplatetoimport.itemsselected.count > 0      'cycle through list , build criteria     = 0 me.listtemplatetoimport.listcount - 1          'is status selected?         if me.listtemplatetoimport.selected(i)              'grab selected template name             mytemplatename = trim(me.listtemplatetoimport.itemdata(i))          end if      next  else      'warn , exit     msgbox "you must select valid template name.", vbokonly, "step: action canceled"      exit sub  end if  'grab bound values mydepartment = me.recordtype 'null error here when using enter key. 


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -