vba - Object required with Access Combobox in With statement -
this separate issue previous 1 had submitted , got with.
i'm trying work code checks numeric id field on form (record set originates query of complex joins) , compares combobox of values, unbound form originates query , fills in combo box, based on numeric id on form. query combo box has 2 columns bound "name" , "id" id field hidden.
i keep getting "object required" error when attempting run code , i've tried debug it. strange thing is: while debugging, each line of code returns/contains values should, access seeing combobox valid object, continues return error.
first shot @ code:
dim parid dim integer parid = me.parentid.value combo217 = 0 .listcount - 1 if .column(1, i).value = parid .value = .itemdata(i) exit end if next end
this didn't work
so tried putting combobox variable , declaring combobox:
private sub command223_click() dim parid dim combo combobox set combo = combo217 parid = me.parentid.value combo = 0 combo.listcount - 1 if .column(1, i).value = parid .value = .itemdata(i) exit end if next end end sub
again same error
finally tried explicitly declare combobox on form it's originating from:
private sub command223_click() dim parid dim combo combobox set combo = forms!dt2!combo217 parid = me.parentid.value combo = 0 combo.listcount - 1 if .column(1, i).value = parid .value = .itemdata(i) exit end if next end end sub
any , watch windows , debug prints keep telling me loop sees values in combo box , assigning correct selection in line:
.value = .itemdata(i)
but continues error out
oh , line it's complaining is:
if .column(1, i).value = parid
well i'll damned! found out problem.
i don't know if syntax issue or logic issue removed .value
from:
if .column(1, i).value = parid
so here's new, working code:
private sub command223_click() dim parid long dim combo combobox set combo = forms![deal tracker query2]!combo217 parid = me.parentid.value combo = 0 combo.listcount - 1 if .column(1, i) = parid .value = .itemdata(i) exit end if next end end sub
Comments
Post a Comment