Parameters for query with Option group on form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with an option gorup for 3 options: All, Signed, Unsigned.
These 3 options refer to a date field in my query for signed proposal
letters. If it is signed I want the dates that are <> null. If NOT signed,
the values = null and if it is All I want everything.

Is there a way to use the option group to get the records I want in my query?
 
I would use VBA code to craft the SQL string. Put it in a button's on click
event.

strSQL = "Select * from TableName"

Select Case ogChoice
'Based on Choice, modify the expression operator
Case "Signed"
strOp = "<>"
case "Not Signed"
strOp = "="
case else
strOp = ""
End Select

If len(strOP) > 0 then
strSql = StrSQL & " WHERE SomeDateField " & strOP & " Null"
end if

'Now do something with the SQL string.
 
Yes, this should be possible. What I would do is to set the GotFocus event
of your option button to apply a filter to the form.

As the criteria for the filter, Signed should have something like Me.Filter
= "Date Is Not Null", and Unsigned should have soemthing like Me.Filter =
"Date Is Null". All should have nothing for the criteria since you want all
of your records.

After this line, you will want to use Me.FilterOn = True to actually apply
the filter.

Hope that helps.

-Chris
 
This one was a bit of a puzzle. I tried it a few ways, but here is how I got
it to work.
First I added a field to the query:
Signed: IsNull([DateSigned])
and unclicked the Show check box for it.
In the in First Criteria Row:
IIf(Forms!MyForm!opgSigned =1,True,False)
In the Second Criteria Row:
IIf(Forms!MyForm!opgSigned =2,False,True)

If it is neither, then all rows will be included.
 
That worked great and seemed to be the easiest of the solutions.

Thanks!

Klatuu said:
This one was a bit of a puzzle. I tried it a few ways, but here is how I got
it to work.
First I added a field to the query:
Signed: IsNull([DateSigned])
and unclicked the Show check box for it.
In the in First Criteria Row:
IIf(Forms!MyForm!opgSigned =1,True,False)
In the Second Criteria Row:
IIf(Forms!MyForm!opgSigned =2,False,True)

If it is neither, then all rows will be included.

Baffee said:
I have a form with an option gorup for 3 options: All, Signed, Unsigned.
These 3 options refer to a date field in my query for signed proposal
letters. If it is signed I want the dates that are <> null. If NOT signed,
the values = null and if it is All I want everything.

Is there a way to use the option group to get the records I want in my query?
 
Back
Top