Search code examples
sql-servervisual-foxpro

How to get data to a combo box in foxpro


I have a combo box and, I need to insert data ranges and select a field to filter data from sql server to get data to the combo box. For that I used this code but the data are not display in the combo box. How can I do this in a correct way?

stra="select cAcctNumber from MAS.dbo.vACP_Payments where cFtyCD=?thisform.cboFactory.value and dPaymentDate>= ?thisform.txtFromDate.Value "
stra=stra+" AND dPaymentDate<= ?thisform.txtToDate.Value and cPaymentTypeDesc='CHEQUE' group by cAcctNumber "
SQLExec(hndOps,stra,'AccNos')


thisform.cboAccNo.Value=AccNos.cAcctNumber 

Solution

  • The Value property of a combobox just indicates which item is selected. You need to set up the RowSource. Since you already have a cursor, the easiest is:

    ThisForm.cboAccNo.RowSource = "AccNos"
    

    Tamar