Subform Help

extreme

Registered User.
Local time
Today, 11:31
Joined
Sep 27, 2004
Messages
51
Please can you help I want to open a form from subform with one click action I have tried through the wizard but it dont work I have looked trough the forum I have tried some of the examples thay dont work can this be done.

Here is a picture

Thanks
 

Attachments

What you would need to do is something like this:

Code:
Dim strWhere As String
Select Case Me.YourOptionGroupNameHere
   Case 0 ' Client
      strWhere = "[Client]='" & Me!YourSearchTextBoxNameHere & "*'"
   Case 1 ' Site
      strWhere = "[Site]='" & Me!YourSearchTextBoxNameHere & "*'"
   Case 2 ' Survey Number
      strWhere = "[Survey No]='" & Me!YourSearchTextBoxNameHere & "*'"
End Select

DoCmd.OpenForm "YourFormNameHere", acViewNormal,, strWhere

Make sure to substitute the correct names for your fields and text box name where applicable.
 
Thanks for the reply but I still cant the code to work is this for the subform or the search
 
Thanks For the help but I still cant get this to work I have made Queries for this but it still dont work have you got any other ideas

Thanks
 
I'll give you an email address via PM where you can send it.
 
I got the code working but this was what I was looking for
Pic Attached
 

Attachments

The code I presented would do it, but you have to substitute my field and text box names with your actual field and text box names. If that parameter box is showing up, then you didn't enter the correct field name for Survey No.
 
The code I presented would do it, but you have to substitute my field and text box names with your actual field and text box names. If that parameter box is showing up, then you didn't enter the correct field name for Survey No.

I have emailed the db now hope you can help

Thanks for your time
 
Did you zip it up again - this time with Normal Compression instead of Maximum? I still haven't received the second version you sent. I have only received the first one which I couldn't unzip.
 
Did you zip it up again - this time with Normal Compression instead of Maximum? I still haven't received the second version you sent. I have only received the first one which I couldn't unzip.

Yep I did what you said its only 1mb now
I will send it again it does say it as been sent
 
Okay, I've been looking at your database.

1. Why do you have a subform on the client search form when you don't need one. You can just put the fields in the main form. Due to the way you have it the code I provided will not work.

2. The Survey number is not even in the recordset of the search form so you can't include that one. If you want to, you can open a different form if the Survey No is selected. That would require moving the code to open the Client Search form into both other Case statements and putting the one to open a Survey search form inside the other Case statement.

3. Change the Select Case statements to

Case 1

Case 2

Case 3

instead of Case 0, Case 1, Case 2 because your controls on the option group have values of 1-3 instead of 0-2 like I was originally thinking.
 
Okay, I've been looking at your database.

1. Why do you have a subform on the client search form when you don't need one. You can just put the fields in the main form. Due to the way you have it the code I provided will not work.

2. The Survey number is not even in the recordset of the search form so you can't include that one. If you want to, you can open a different form if the Survey No is selected. That would require moving the code to open the Client Search form into both other Case statements and putting the one to open a Survey search form inside the other Case statement.

3. Change the Select Case statements to

Case 1

Case 2

Case 3

instead of Case 0, Case 1, Case 2 because your controls on the option group have values of 1-3 instead of 0-2 like I was originally thinking.

Thanks for your help I will be honest im not sure what you mean as im a newbi at vb but I will try and change it around.

Thanks for all your help
 

Users who are viewing this thread

Back
Top Bottom