vba - Populate multiple textboxs from openrecordset on Access form -
i trying populate multiple textboxs openrecordset , getting following error
run-time error 3601 few parameters. expected 1
here function
function fnsearchandpopulate() boolean dim d dao.database, r dao.recordset, strsql string set d = currentdb if me.txtenternumber = "" msgbox "please enter number", , "error" exit function end if strsql = "select * amipartnumbers inner join jdsubs on amipartnumbers.oemitem=jdsubs.oempartnumber " & txtenternumber.value & " in (jdsubs.oempartnumber, jdsubs.oemsubnumber)" set r = d.openrecordset(strsql) if r.eof msgbox "bam # " & me.txtenternumber & " not exist!", , "no bam #" set d = nothing exit function end if 'get here if there record r.movefirst 'populate whatever textboxes me.txtaminumber = r!item me.txtdescription = r!description me.txtoemsubnumber = r!oemsubnumber set d = nothing exit function end function
updated non-numeric part numbers...
strsql = " select * amipartnumbers inner join jdsubs on " & _ " amipartnumbers.oemitem=jdsubs.oempartnumber " & _ " jdsubs.oempartnumber= '" & txtenternumber.value & "' or " & _ " jdsubs.oemsubnumber= '" & txtenternumber.value & "'"
Comments
Post a Comment