Show in cascading combo records only where a field = true

KevinSlater

Registered User.
Local time
Today, 23:46
Joined
Aug 5, 2005
Messages
249
Hello, this is a fairly small problem (I think) the below cascading combo box works ok.

However there’s a Yes/No field named “CURRENT_PRODUCT” in the query named: “SCREEN_ADD_PRODUCT” and I would like to display in the combo box: “CBO_PART_CODE” only the products that have a tick in this field (Ie where the field CURRENT_PRODUCT is true).
---------------------------------------------------------------
Private Sub CBO_SAL_ACCOUNT_AfterUpdate()
On Error Resume Next
CBO_PART_CODE.RowSource = "Select DISTINCT SCREEN_ADD_PRODUCT.STK_PART_CODE, STK_DESCRIPTION " & _
"FROM SCREEN_ADD_PRODUCT " & _
"WHERE SCREEN_ADD_PRODUCT.SAL_ACCOUNT = '" & CBO_SAL_ACCOUNT.Value & "' " & _
"ORDER BY SCREEN_ADD_PRODUCT.STK_PART_CODE;"
End Sub
------------------------------------------------------------
I believe I need to change the above WHERE clause to something similar to the below line:

"WHERE SCREEN_ADD_PRODUCT.SAL_ACCOUNT = '" & CBO_SAL_ACCOUNT.Value & "' " & _ SCREEN_ADD_PRODUCT.CURRENT_PRODUCT = True" & _

but this doesn’t work, neither does the below code :confused:

"WHERE SCREEN_ADD_PRODUCT.SAL_ACCOUNT = '" & CBO_SAL_ACCOUNT.Value & "' " & _
“WHERE SCREEN_ADD_PRODUCT.CURRENT_PRODUCT = True" & _

any ideas where im going wrong?, I guees its something quite minor but ive spent some time trying to fix this & now lost on what I need to do?
 
"WHERE SCREEN_ADD_PRODUCT.SAL_ACCOUNT = '" & CBO_SAL_ACCOUNT.Value & "' " & _
“WHERE SCREEN_ADD_PRODUCT.CURRENT_PRODUCT = True"

You are using a "&" instead of "AND"
 
Thanks nunca_habla, this works now.
 

Users who are viewing this thread

Back
Top Bottom