Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 23rd, 2005, 12:05 PM
LouiLoui LouiLoui is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 4 LouiLoui User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 6 sec
Reputation Power: 0
Question Apply Filter from a combo box to a report

Hi guys,
I need to set up a filter from a from with 4 different combo box.
I name the combox boxes Filter1, Filter2 and so on.
I'd like to be able to filter one by one and all then together, just like
the way you filter on an excel sheet. Here is the code that I'm having
problem with

Dim strSQL As String, intCounter As Integer
'Build SQL string
For intCounter = 1 To 4
If Me("Filter" & intCounter) <> " " Then

strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "]" _
& " = " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & "" _
And ""
End If
Next

If strSQL <> " " Then
'Strip Last " And "
strSQL = Left(strSQL, (Len(strSQL) - 5))

'Set the filter Property
Reports![rpt_FIELDREP_MASTER].Filter = strSQL
Reports![rpt_FIELDREP_MASTER].FilterOn = True

the strSQL variable is giving me a mismatch error.

Can anyone one help me pleaseee....!!!!
A lot of thanks in Advance...!!!

Loui,

Reply With Quote
  #2  
Old February 24th, 2005, 09:22 AM
Mr_Jones Mr_Jones is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 20 Mr_Jones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 15 m 34 sec
Reputation Power: 0
what values are in the drop down combos? if they are numbers then you might be gettinga mismatch error as you are trying to put a number (from the combo) into the strSQL variable which is a string. Try converting the combo value to a string by using the CStr() function i.e. CStr(me("filter" & intCount) etc etc).

Reply With Quote
  #3  
Old March 3rd, 2005, 12:16 PM
LouiLoui LouiLoui is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 4 LouiLoui User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 6 sec
Reputation Power: 0
Red face

Hey Mr Jones,

Thanks so much, I'll try this and I let you know. Appreciate your help, I'll get back to you shortly.

Loui




Quote:
Originally Posted by Mr_Jones
what values are in the drop down combos? if they are numbers then you might be gettinga mismatch error as you are trying to put a number (from the combo) into the strSQL variable which is a string. Try converting the combo value to a string by using the CStr() function i.e. CStr(me("filter" & intCount) etc etc).

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Apply Filter from a combo box to a report


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT