PDA

View Full Version : Filter Row Source



RobertBC
09-10-2006, 09:09 AM
good day! :friends:

iam very new to VBA i have this problem selecting the right PONo using combo box... I want my selection on combo box to be filtered.. PONo that is already exist in previous invoice should not appear on my combo box..

pls help me how to do it in vba, i dont think that sql can handle multiple return value on its sub query.. attached are my sample vba on frmInvoiceMaster i put some instructions how to filter my data.

thank you very much again....

:bow: :bow: :bow:

Imdabaum
09-19-2006, 12:08 PM
I'm working right now and a little behind on a project but I'll take a look and see what I can do.... I'm not great at figuring things out, but I'll try.

Imdabaum
09-26-2006, 01:23 PM
I think what I would do is create some sort of check to identify what field you want filtered on the combo box. Then create a query that would create that filter. Then set your cboBox.RecordSource = qry

RobertBC
09-29-2006, 02:48 AM
Thanks

I got it now i use this query to filter my selections..

SELECT OrderDetails.PONo
FROM OrderMaster INNER JOIN OrderDetails ON OrderMaster.OrderNo = OrderDetails.OrderNo
WHERE (((OrderDetails.PONo) Not In (Select InvoiceDatails.PONo from InvoiceDatails)) AND ((OrderMaster.CustomerID)=[forms]![frmInvoiceMaster]![CID]));

then on On_click event i use this (me.refresh)

now i'll be able to select all the PONo that has not been invoiced by customer..

i also use this (PONo.column(1)) to populate textbox for Amount

it works well as soon as i found out that whe i select again the combobox for PONO for the second row the value on Amount on the first row or on the previous row now is disappear. i dont know how it happen..

Another thing is I create a query to Sum all the Amount as Total Amount and use the query as a sub form on the same Invoice Form...

the result of that query wont refresh as i add or select multiple rows on my Invoicedetails subform(happens to be a child form of Invoice Form too)

i attached my sample file so you can figure how it happen..

thanks for the help guys....:help