Mansoor Ahmad
Registered User.
- Local time
- Today, 16:09
- 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 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