Milothicus
Registered User.
- Local time
- Today, 09:49
- Joined
- Sep 24, 2004
- Messages
- 134
I'm building a string of criteria with a public function, but can't get the query to recognize it. i've stepped through the code, and it should work, but i can't figure out the syntax to get my query to recognize the criterion.
well, i may as well describe the whole situation.
i have a field in my table that categorizes the records. for search purposes, if the value is from 0 to 6, it's current, if it's 7 it's won, 8 it's lost. i have checkboxes on my search page to include or exclude each of the 3 categories. here's the code in my function:
where won, lost, and current are passed through the function from the form. this works fine too. i've tested it. it's just the passing of the string to the criterion field in the query design that's not working.
edit: here's what's in the criterion box:
fEnqStg([Forms]![frmOverall]![optOrdrEB],[Forms]![frmOverall]![optHistEB],[Forms]![frmOverall]![optCurrentEB])
well, i may as well describe the whole situation.
i have a field in my table that categorizes the records. for search purposes, if the value is from 0 to 6, it's current, if it's 7 it's won, 8 it's lost. i have checkboxes on my search page to include or exclude each of the 3 categories. here's the code in my function:
Code:
Public Function fEnqStg(won, lost, current)
Dim str As String
str = ""
If current Then
str = str + "BETWEEN 0 AND 6"
End If
If won Then
str = str + " OR 7"
End If
If lost Then
str = str + " OR 8"
End If
fEnqStg = str
End Function
where won, lost, and current are passed through the function from the form. this works fine too. i've tested it. it's just the passing of the string to the criterion field in the query design that's not working.
edit: here's what's in the criterion box:
fEnqStg([Forms]![frmOverall]![optOrdrEB],[Forms]![frmOverall]![optHistEB],[Forms]![frmOverall]![optCurrentEB])
Last edited: