With my code below, I am trying to filter the 1 report for each record set in the "Temp Table". The report is filtered from a query "Carrier Report". -
Public Function OrgIDReports()
-
-
Dim db As DAO.Database
-
Dim rs As DAO.Recordset
-
Dim sqlStr As String
-
-
sqlStr = "SELECT * FROM [Temp Table]"
-
-
Set db = CurrentDb
-
Set rs = db.OpenRecordset(sqlStr)
-
-
rs.MoveFirst
-
-
Do While Not rs.EOF
-
DoCmd.OpenReport "I# Report", acViewNormal, , "[Carrier Report].[I#]= & rs"
-
rs.MoveNext
-
Loop
-
-
MsgBox ("End of Client Org IDs")
-
-
End Function
-
I am currently receiving a "Run time 3075 - Syntax Error (missing operator) in query expression '([Carrier Report].[I#]=&rs)'. With the below line: -
DoCmd.OpenReport "I# Report", acViewNormal, , "[Carrier Report].[I#]= & rs"
-
Any ideas what I am doing wrong???
In that case : - Call DoCmd.OpenReport("I# Report", acViewNormal, , "[I#]=" & rs![I#])
10 3094
I would guess it's how you are sending over the variable rs. Try taking it out of the quotations so it would look like this. -
DoCmd.OpenReport "I# Report", acViewNormal, , "[Carrier Report].[I#]=" & chr(34) & rs & chr(34)
-
-
NeoPa 32,556
Expert Mod 16PB
Marc's on the right lines but the code's a bit more broken than just that it seems. You also need to provide some value from your rs recordset and it needs to be surrounded by the relevant characters for the type of data. A reference of rs on its own simply points to a recordset object which is unusable. One of the properties must be specified.
When I enter your code, I am now getting a "Type Mismatch" error
Neopa - I'm not quite sure I follow. Can you post an example?
NeoPa 32,556
Expert Mod 16PB
@EpiphanyGirl - Call DoCmd.OpenReport("I# Report", acViewNormal, , "[I#]=" & rs.?)
What type of data is [I#]?
Which field within [Temp Table] are you trying to match it with?
I# is a number and the column in [Temp Table] is called I# as well.
NeoPa 32,556
Expert Mod 16PB EpiphanyGirl:
NeoPa - I'm not quite sure I follow. Can you post an example?
Your subsequent post (#4) illustrates exactly what I was saying.
If you answer the questions in my post #6 I can illustrate the point. I don't yet have enough information from you to do so.
PS. Clearly we are cross-posting ATM, so be patient. I'm sure we'll get it resolved shortly.
NeoPa 32,556
Expert Mod 16PB
In that case : - Call DoCmd.OpenReport("I# Report", acViewNormal, , "[I#]=" & rs![I#])
Perfect!! Thanks so much!!
One last question - When the OpenReport happens, I have the settings set-up so that it automatically prints the report to PDF (using Scansoft), however, since it's filtered from the same report, everything is saved with the same file name (ie - the report name). Would you know of a way to alter this so that it would also include the I# field that is it filtering on?
NeoPa 32,556
Expert Mod 16PB
That may be a problem. I understand that the name of the file is directly linked to the name of the report. Unless you were to create a copy of the report for every time you ran it, possible as a standard database but not when rolled out as an MDE or ACCDE, this would not be possible.
If you're interested in exploring that further, post a question on it and I'll go into more detail. I can't do so here as it's a thread for a different question.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: arthur-e |
last post by:
I can filter a query for a report on a field of a subform BUT now....
I'd like to be able to select more than one item in a multi-list box
to select all the records.
ALSO
to use two fields (or...
|
by: Tom Louchbaum |
last post by:
Can someonw pls tell me how to reference the Where clause made by the
VBA statement
DoCmd.OPENREPORT "Report",acviewpreview,,where
as a control within the Report itself?
Thanks.
|
by: access03 |
last post by:
Hello,
this is my question --
I need to create a multi-page report. each page is about a product
selected during runtime. the number of products is also decided at
runtime.
right now, i...
|
by: olle |
last post by:
hi everyone.
I have this code to apply the filter on a form to a report.
In Access97 it worked fine but when I converted it to Access2000 the
report shows all records in the table. What has...
|
by: Thall |
last post by:
Hey Gurus - I've seen a few solutions to this problem, but none of which I can do without a little help. Here's the situation
The following code loops thru a sales report, using the sales rep ID...
|
by: Simon |
last post by:
Dear reader,
The syntax for Docmd.OpenReport is:
OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode,
OpenArgs)
Example
The following example prints Sales Report while...
|
by: Joelle |
last post by:
Hi everyone,
i am really stack!i need help
I have this report:"RequirementObjects_Report",i have also a multiselect listbox whicg contains a list of products.what i want to do is to filter the...
|
by: franc sutherland |
last post by:
Hello,
I have a report which I filter using the me.filter command in the
OnOpen event.
Me.Filter = "OrderID=" & Forms!variable_form_name!
Me.FilterOn = True
I want to be able to open that...
|
by: tmallen |
last post by:
I'm parsing some text files, and I want to strip blank lines in the
process. Is there a simpler way to do this than what I have here?
lines = filter(lambda line: len(line.strip()) 0, lines)
...
|
by: Marie Gardner |
last post by:
Hi,
I want to create a form that filters a report that is between a date range, and includes only the data for the item selected in the combo box.
For example, I am creating a time manager...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |