Option group and combo box problem

Mansoor Ahmad

Registered User.
Local time
Today, 19:46
Joined
Jan 20, 2003
Messages
140
Dear All

(Message for Namliam if he reads this mail, thank you very much for your help yesterday on a similar issue of option groups. I did finally managed to do the way I wanted it to be. Thanks)

I want to filter the records using two parameters.

I want one parameter to be selected from a combobox and the second one from an option groups. So the structure would be somewhat similar to as follows

Cumbo box = Customer

Option group
Option1
Option2
Option3

Combo box1 = linked to Option1
Combo box2 = linked to Option2
Combo box3= linked to Option3

Command button = Open report


Now what I want is,

I select a customer from combo box and select one of the three options and click on Open report button to view the report (based on a query) which should be filtered by Customer and Option1 (PART NO) field and so on.

I have managed to develop some code but there is something I am doing wrong because the report does open if I run the code individually e.g either only for customer or only for Option1(PART NO), but not when I put both in the code.

Sub viewresults(PrintMode As Integer)

Dim myInt As String
Dim myInd As String

myInd = CmbCustomer

Select Case Me!frame2
Case 1
myInt = Forms![F_rqform]!CmbOption1

DoCmd.OpenReport "Report3", acViewPreview, , "[CUSTOMER] = '" & myInd & "'" And "[PART NO] = '" & myInt & "'"

Case 2
myInt = Forms![F_rqform]!CmbOption2
DoCmd.OpenReport "Report3", acViewPreview, , "[CUSTOMER] = '" & myInd & "'" And "[REF NO] = '" & myInt & "'"

Just a reminder that I am at the very early stages of learning VB codes, so I might have made a major mistake.

Looking forward to your reply
 
(Message for Namliam if he reads this mail, thank you very much for your help yesterday on a similar issue of option groups. I did finally managed to do the way I wanted it to be. Thanks)
I did read it ;), happy to help
Code:
DoCmd.OpenReport "Report3", acViewPreview, , "[CUSTOMER] = '" & myInd & "'" And "[PART NO] = '" & myInt & "'"

You have a " to many (again) just before and after the And

Code:
DoCmd.OpenReport "Report3", acViewPreview, , "[CUSTOMER] = '" & myInd & "' And [PART NO] = '" & myInt & "'"

Regards

The Mailman
 
Namliam

You are a star. I have been fiddling with this code since this morning and couldn't get it right. There it was just a mistake of ".

Because I do not have proper understanding of VB codes so I have been trying to rearrange " and , but unlucky, could not put then at right location.

Thank you very much for your help.

And before I leave, you have confused :rolleyes: me again with your name, this is how I got the blame last time.

On left hand side it is Namliam and on the bottom after regards it is Mailman. What is this all about?

Regards

Mansoor
 
Mailman is my nick, namliam my Handle...

Many a times Mailman is taken, but namliam hardly ever is.... Its just the reverse... Nothing else... I got sick of Mailman654998675 or something like that....

Regards
 

Users who are viewing this thread

Back
Top Bottom