access vba - How do I store textbox name reference in a Variable to later assign the value of that textbox to another variable -
i have access project i'm working , after great amount of research can't find simple answer. have unbound form 10 textboxes. need add same code double click event of each 1 of boxes. need pass on name of active textbox , value of such form. here sample code illustrates i'm trying do.
textbox1 = date (is active control) dim x1, x2 string dim x3 date x1 = me.activecontrol.name x2 = "me." & x1 & ".value" x3 = x2 msgbox x3
this give error datatype mismatch gives me string assigned x2 (me.textbox1.value) instead of date. thank in advance help.
you're creating string variable , assigning variable x2.
to actual value need pull form's controls collection.
try instead:
x2 = me.controls(x1).value
Comments
Post a Comment