Parameter Query

Snowflake68

Registered User.
Local time
Today, 21:37
Joined
May 28, 2014
Messages
464
[SOLVED] I have a form which is bound to a query (which queries a table called 'dbo_QnRegDetail')

I have a field called 'Status' which contains values of either 'Open' or 'Closed'

I want to be able to filter the results in the datasheet of the form by selecting the status from a combo box. I have this working using the following code in the criteria of a query.

Code:
[Forms]![frmMain]![NavigationSubform].[Form]![cboStatus]

However I want to be able to see 'All' records so I have added the value 'All' to the combo box list and changed the query to the code below but it doesnt show any records when I change the combo box to 'All'. I have been playing around with the code and it would appear that it doesnt like the wildcard bit.
Code:
Like "*"

Code:
IIf([Forms]![frmMain]![NavigationSubform].[Form]![cboStatus]="All",([dbo_QnRegDetail].[Status]) Like "*",[Forms]![frmMain]![NavigationSubform].[Form]![cboStatus])

Any ideas?
 
Last edited:
try

WHERE [Forms]![frmMain]![NavigationSubform].[Form]![cboStatus]="All" OR [dbo_QnRegDetail].[Status] =[Forms]![frmMain]![NavigationSubform].[Form]![cboStatus]
 
try

WHERE [Forms]![frmMain]![NavigationSubform].[Form]![cboStatus]="All" OR [dbo_QnRegDetail].[Status] =[Forms]![frmMain]![NavigationSubform].[Form]![cboStatus]

This works perfectly, thank you so much. I have no idea why the part before the OR statement works but it does :o
 

Users who are viewing this thread

Back
Top Bottom