Search Opition Group

extreme

Registered User.
Local time
Today, 11:56
Joined
Sep 27, 2004
Messages
51
Hi all

I have searched the forum and tried several of the options posted.

I have a search option and I want to open a form to display my clients. I have made a query for this but I just cant configer code can someone please help me on this one.

I have attached a picture so you can see what I mean

Thanks
 

Attachments

  • pic2.JPG
    pic2.JPG
    36 KB · Views: 135
I think you can use filter.

Use "if then else" to make different filters depending on the option selected:

strSearchOption = Me.searchgroupname
If (strSearchOption = value1) then
strFilter = whatever
ElseIf (strSearchOption = value2) then
strFilter = whatever

And so on
 
I think you can use filter.

Use "if then else" to make different filters depending on the option selected:

strSearchOption = Me.searchgroupname
If (strSearchOption = value1) then
strFilter = whatever
ElseIf (strSearchOption = value2) then
strFilter = whatever

And so on


Thank you for the reply I have tried that t doesnt work
 
It looks like your search form is actually a form with a subform. Is that correct?

Also, as far as option groups go, you can check their values by using the option group itself and don't check for each individual control:

Code:
Dim sFilter As String

Select Case YourOptionGROUPNameHere
   Case 1
     sFilter = "[Client]='" & Me.YourEntryBoxNameHere & "'"

   Case 2
     sFilter = "[Site]='" & Me.YourEntryBoxNameHere & "'"

   Case 3
     sFilter = [SurveyNo]=" & Me.YourEntryBoxNameHere
End Select
With Me
  .Filter = sFilter
  .FilterOn = True
End With

If using a subform for the results then change the Me.Filter and Me.FilterOn to
Code:
With Me.YourSubformContainerNameHere.Form
   .Filter = sFilter
   .FilterOn = True
End With
And YourSubformContainerNameHere refers to the actual control that houses the subform on the main form. The container control and the subform itself can be named the same, but they aren't necessarily so. So, make sure to use the container control's name instead of the subform name, if they aren't named the same.
 

Users who are viewing this thread

Back
Top Bottom