السلام عليكم
i created empty list box in form with columncount 1
now i have 3 different select statemnt, they will have different column result , is there is any way to set the columncount dynamiclly?
but when i try to print the result in the listBox i always get only the first column (this is true coz i set the column count to 1)
'customerNameCB = comboBox
'SearchB = Button
'productsCB = comboBox
''addressCB = comboBox
here is the method
Private Sub SearchB_Click() Me.SearchB = Me.SearchB.DefaultValue Dim querystirng As String resultList.ColumnHeads = True querystirng = "" If customerNameCB.Enabled = True And (customerNameCB.Value <> customerNameCB.DefaultValue) Then querystirng = "select le_Order.Order_id, le_Order.OrderDate, orderline.ProductID, Product.Model, Product.[Description] from le_Order,orderline,product where le_Order.Order_id = orderline.orderid And orderline.ProductID = product.ProductID And le_Order.Customer_id ='2'" ElseIf productsCB.Enabled = True And (productsCB.Value <> productsCB.DefaultValue) Then querystirng = "select distinct le_Order.Order_id, le_Order.OrderDate, le_customer.CustomerName,le_customer.Adress,orderline.Quantity from le_Order,orderline,product,le_customer where le_Order.Order_id = orderline.orderid And le_Order.Customer_id =le_customer.customer_id And orderline.ProductID = '40';" ElseIf addressCB.Enabled = True And (adressCB.Value <> addressCB.DefaultValue) Then querystirng = "select le_Order.Order_id, le_Order.OrderDate from le_order " End If If (querystirng <> "") Then resultList.RowSource = querystirng End If Me.SearchB = Me.SearchB.DefaultValue End Sub
now if i use this i get only one coulmn of the result