Hi All,
I am having trouble filtering a report with a multiselect list box. The report is generated, but it is not filtered based on the selections of the list box: lstVehID
Multi Select Simple
Row Source Type Table/Query
Row Source SELECT qryVehicle.Vehi cle, qryVehicle.[RBL Status] FROM qryVehicle ORDER BY qryVehicle.Vehi cle;
Users enter their information into form: frmCustomers
A command button ( cmdPOHCReport) opens the report: rptPOHC
which is run off query: qryPOHC_Custome r
I am using Allen Browne's VBA code to filter the query with the selections from the list box.
In an Access 2003 version of this database I was able to set strDoc = "Name of Report", however now
If I set
strDoc = "rptPOHC"
I get a message box asking me for [Vehicle]
If I set
strDoc = "qryPOHC_Custom er"
I get "Error 2467 - The expression you entered refers to an object that is closed or does not exist"
I have attached a copy of the DB. Any help would be much appreciated - Private Sub cmdPOHCReport_Click()
-
-
On Error GoTo Err_Handler
-
'Purpose: Open the report filtered to the items selected in the list box.
-
'Author: Allen J Browne, 2004. http://allenbrowne.com
-
Dim varItem As Variant 'Selected items
-
Dim strWhere As String 'String to use as WhereCondition
-
Dim strDescrip As String 'Description of WhereCondition
-
Dim lngLen As Long 'Length of string
-
Dim strDelim As String 'Delimiter for this field type.
-
Dim strDoc As String 'Name of report to open.
-
-
strDelim = """" 'Delimiter appropriate to field type. See note 1."
-
strDoc = "qryPOHC_Customer"
-
-
'Loop through the ItemsSelected in the list box.
-
With Me.lstVehID
-
For Each varItem In .ItemsSelected
-
If Not IsNull(varItem) Then
-
'Build up the filter from the bound column (hidden).
-
strWhere = strWhere & strDelim & .ItemData(varItem) & strDelim & ","
-
'Build up the description from the text in the visible column. See note 2.
-
strDescrip = strDescrip & """" & .Column(0, varItem) & """, "
-
End If
-
Next
-
End With
-
-
'Remove trailing comma. Add field name, IN operator, and brackets.
-
lngLen = Len(strWhere) - 1
-
If lngLen > 0 Then
-
strWhere = "[Vehicle] IN (" & Left$(strWhere, lngLen) & ")"
-
lngLen = Len(strDescrip) - 2
-
If lngLen > 0 Then
-
strDescrip = "Categories: " & Left$(strDescrip, lngLen)
-
End If
-
End If
-
-
'Report will not filter if open, so close it. For Access 97, see note 3.
-
If CurrentProject.AllReports(strDoc).IsLoaded Then
-
DoCmd.Close acReport, strDoc
-
End If
-
-
'Omit the last argument for Access 2000 and earlier. See note 4.
-
DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere, OpenArgs:=strDescrip
-
-
Exit_Handler:
-
Exit Sub
-
-
Err_Handler:
-
If Err.Number <> 2501 Then 'Ignore "Report cancelled" error.
-
MsgBox "Error " & Err.Number & " - " & Err.Description, , "PrevLim_Click"
-
End If
-
Resume Exit_Handler
1 1854
Whats the query or table that the report is based on? That information is missing from your question, and sorry, I wont start downloading attachments from unknown sources. You will have to provide the information in your question.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Anand |
last post by:
Hi i am having trouble adding a recordset into the access database,
the code seems to be working fine it passs and parses through all
variables just fine without showing any errors and also when i access
the recordset it displays the results, what the real issue is that the
entry is not made into the database even though i use the Update...
|
by: ed |
last post by:
i'm having trouble with a form. I want to be able to type in the address of
the form with the data for the form items in the URL (ie:
http://somesite.com/formpage.html?field1=data1&field2=data2).
It saves the data if I type it in manually to an html file. But it won't do
that if I use the URL notation above. How do I get it to do this. ...
|
by: Lauren Wilson |
last post by:
I'm having trouble with the Access VBA help on my installation of A2K
with Dev tools. Every time I try to retrieve help for items listed in
the Object Browser (and SOME other items as well), Access tells me
that the "feature is broken" and prompts me to repair it. When I do
so, it goes through the motions but does NOT repair the help files....
|
by: Jozef |
last post by:
Hello,
I am trying to put together a module and open a workspace on a database that
has a simple password (using Access XP). This is the lin that I'm having
trouble with;
Set wrk = CreateWorkspace("TestWrkspc", "Admin", conDbPwd)
conDBPwd is a variable that contains the password. There is no independant
workgroup file, just the...
|
by: Jozef |
last post by:
Hello,
I'm having trouble with the download links on my web server. The error I'm
getting is;
CGI Timeout
The specified CGI application exceeded the allowed time for processing. The
server has deleted the process.
It's a fresh Windows 2000 server install, but I also installed the ASP.net
| |
by: Jozef |
last post by:
Hello.
I'm having trouble creating a blank solution (and ASP.net web application)
from my laptop. I own the server (in fact it's sitting right next to me)
and have added the URL to the trusted sites on my laptop. Here are the
details;
This is what I'm selecting from the start page....
>Add New Blank Solution
>Visual Basic Projects,
|
by: Jake Barnes |
last post by:
I've read over the documentation for these effects:
http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo
I want to include them on my page. I tried attaching using onload, but
that didn't work. In fact, I can not get them to work even as inline
commands. I click on the DIV with the id of newMailList, I only get an
errror....
|
by: Michael |
last post by:
Hi all,
I'm having trouble PInvoking a TCHAR within a struct.
I'll paste the specific struct's API definition below.
I've tried so many numerous variations.
The main Win32 error I get is 0x3f0 / 515L which amounts to ERROR_NO_TOKEN.
Every single instance of this in the past was due to mistakes I made while
within PInvoked structs.
Is...
|
by: tkondal |
last post by:
Hi all.
I just started looking at Python's ctypes lib and I am having trouble
using it for a function.
For starters, here's my Python code:
from ctypes import*;
myStringDLL= cdll.LoadLibrary("myStringDLL.dll");
|
by: Stu |
last post by:
Hi guys,
I've been having trouble getting the clock function to work portably,
please could I get some thoughts?
<Possibly OT comments>
It works fine on my laptop (under WinXP) and on my office computer
(under Linux), but I have to write some code for the system simulator
for the Cell BE processor (the thing inside the PS3), which is...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |