using value of string as criteria

schalkse

Registered User.
Local time
Today, 12:34
Joined
Apr 20, 2005
Messages
51
Hi guys,

Maybe this one has been solved somewhere, but can't find it. So here it goes.

I have a form with some listboxes and a checkbox. I have written some code that checks if the fields are empty or not. I will explain for one field called "SelectId" . When it is empty, a string i have defined gets the following value "Is Not Null". When something is choosen the same string gets the value "Forms![frmRapportActiepunten]![SelectId]"

I also have a button when pressed runs a query. But, i need the value of that same string as the criteria.
How do i end up with "Forms![frmRapportActiepunten]![SelectId]" or "Is Not Null" (depending on the value of that string) in the criteria field of that query?

Hope somebody can give me a solution.

Thanks
 
Remove the criteria from your query. Access will not parse a string into a logical criteria statement.

Instead, add a new column to your query as follows:

Field: IIf(IsNull([Forms].[frmRapportActiepunten].[SelectId]),True, CBool(InStr(1, [Forms].[frmRapportActiepunten].[SelectId],[MyTblOrQry].[MyField])))
Show: False (not checked)
Criteria: = True

hth,
 

Users who are viewing this thread

Back
Top Bottom