vba - How to locate data source for unbound control? -
i've inherited access vba code , there controls on form (such listbox named lstorderid
, mentioned below) have no rowsource property set (an empty string). in code , find statements in various places:
forms!frm_customer.lstorderid = rstcust!orderid ' set record set
forms!frm_customer.lstorderid.requery
me.lstorderid = me.lstorderid.itemdata(0) ' set first item in self
but in code lstorderid.rowsource being set.
how can requery
called on listbox has no rowsource?
how can listbox set single value (rstcust!orderid
) record set, unless list of values (although debugger shows integer in lstorderid.value
)?
here more code:
dim rstcust recordset set db = currentdb set rstcust = db.openrecordset("select * orders custid=" & id & _ "and datetaken =date() " & _ "and vendorid='" & forms!frm_customer.cbovendorid & "'") forms!frm_customer.lstorderid = rstcust!orderid rstcust.close db.close
another section:
dim rstcust recordset dim blstatus boolean dim strsql string set db = currentdb strsql = "select orders.orderid " & _ "from orders " & _ "where (((orders.datetaken)=#" & date & "#) " & _ "and ((orders.vendorid)='" & forms!frm_customer.cbovendorid & "') " & _ "and ((orders.custid)=" & id & "));" set rstcust = db.openrecordset(strsql) forms!frm_customer.lstorderid = rstcust!orderid forms!frm_customer.lstorderid.requery forms!frm_customer.lstorderid = rstcust!orderid rstcust.close db.close
also this:
me.lstorderid.requery me.lstorderid = me.lstorderid.itemdata(0)
Comments
Post a Comment