473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

openReport

4 Nibble
Trying to open a report with multiple WHEREconditions. I have 4 strings (SelA, SelB, SelC, whereStr) all defined as strings.

SelA, SelB SelC all pieces of the whereStr

If I set whereStr = {any of the individual strings A,B or C}, the following works

DoCmd.OpenReport "rptName", acViewReport , , whereStr

When I try to concatenate the stings into 'whereStr', I only get the first string listed in the report.

Anyone? Help?
Jul 20 '21 #1
9 3657
cactusdata
214 Expert 128KB
Concatenate? How? They are there already: SelA, SelB SelC all pieces of the whereStr

And do you wish to filter on four fields or one field?
Jul 20 '21 #2
bryonone
4 Nibble
If I set
whereStr=SelA
It works fine

how do I get the whereStr to be equal to SelA, SelB, and SelC.

I want to filter on all 3 fields.

Any thoughts?
Jul 20 '21 #3
cactusdata
214 Expert 128KB
Try with:

Expand|Select|Wrap|Line Numbers
  1. whereStr = SelA & " And " & SelB & " And " & SelC
Jul 20 '21 #4
bryonone
4 Nibble
I had tried that before. It only recognizes the first string and ignores the rest. I just tried again triple checking the & and "". Still does not work.

I also tried in the 'WHERE" entry,
SelA + SelB + SelC
Jul 20 '21 #5
cactusdata
214 Expert 128KB
Without the content of SelA, B, and C, we can't help.
Jul 20 '21 #6
bryonone
4 Nibble
Expand|Select|Wrap|Line Numbers
  1. Dim SelLic, SelSW, SelArea As String
  2. Dim whereStr As String
  3.  
  4. SelLic = "[swLicName]= Forms![frmViewLicToLoc]![txtSelectedLicense] _
  5.     OR Forms![frmViewLicToLoc]![txtSelectedLicense] is null _
  6.     OR Forms![frmViewLicToLoc]![txtSelectedLicense]=''"
  7.  
  8. SelSW = "[swName]=Forms![frmViewLicToLoc]![txtSelectedSW] _
  9.     OR Forms![frmViewLicToLoc]![txtSelectedSW] is null _
  10.     OR Forms![frmViewLicToLoc]![txtSelectedSW]=''"
  11.  
  12. SelArea = "[areaLocation] = Forms![frmViewLicToLoc]![txtSelectedArea] _
  13.     OR Forms![frmViewLicToLoc]![txtSelectedArea] is null _
  14.     OR Forms![frmViewLicToLoc]![txtSelectedArea]=''"
  15.  
  16.     whereStr = SelSW
  17.  
  18.     DoCmd.OpenReport "rptViewSearch", acViewReport, , whereStr
Jul 20 '21 #7
isladogs
455 Expert Mod 256MB
Suggest you look at the code in the two example Databases from my article Multiple Group and Filter.
These are designed to show ways of building filter criteria when several filter criteria are entered
Jul 20 '21 #8
cactusdata
214 Expert 128KB
Try reducing these like:

Expand|Select|Wrap|Line Numbers
  1. SelLic = "[swLicName] = Nz(Forms![frmViewLicToLoc]![txtSelectedLicense], [swLicName])"
Jul 20 '21 #9
NeoPa
32,556 Expert Mod 16PB
Hi Bryon.

I would suggest you're getting in your own way here. Massively overcomplicating what should be fundamentally straightforward. See How to Debug SQL String for how to make this much easier for yourself. I suspect once you start following this simple guidance you will no longer need any external help.

Can we assume that you understand and recognise how a WHERE clause is formatted and works within SQL (SQL format closely matches what is expected in the WhereCondition parameter that we're talking about here from your code.)? If not then we have to look at some very basic work with you, but as you'll already have seen, we have many willing helpers who can do that as long as they realise it's necessary.

I suspect once we stop following you round in circles we can reach a solution that not only works for you, but also one that you'll understand and be able to use in future.

Best of luck & welcome to Bytes.com.
Jul 20 '21 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Aaron | last post by:
Hello, I'm trying to limit a report to a list of parameters that I pass in. The report and the underlying query both use the column FirstName. Whenever I try to limit the FirstName in via the...
1
by: Andrew | last post by:
Hi All: I am using Access2000 and I find that the command to open an Access report in preview mode is very slow: DoCmd.OpenReport rptABC, acViewPreview, "", "" The scenario is this: - The...
3
by: Blah | last post by:
Hello, I'm trying to use the where clause in OpenReport to limit the data return on the subreport. Is there a way to do it using that method or OpenReport only work with the report you're...
1
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.
5
by: fearblanco | last post by:
Hello - I am receiving the below error message when attempting to open a report. This database is used by approximately 20 users and only one user is having this problem (even I can't duplicate...
1
by: kistemaker | last post by:
Hi, I could need your help. I am working with ACC97 as frontend and Oracle9 as database. All Queries are made as pass-through-queries. Everything looks fine, but I can't handle the OpenReport to...
4
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...
1
by: MLH | last post by:
Stephen Lebans has a function named ConvertReportToPDF that I use from time to time. It's quite handy, actually. In that FN is a line that reads as follows: DoCmd.OutputTo acOutputReport,...
4
by: gazza10001 | last post by:
Hi i hope you can help my company uses access and has modified for its needs usually what happens is you serach for the invoice by its number and then it brings all the information up such as...
5
by: RalphBenoy | last post by:
I have not much programming experience but would like to OpenReport in Access using a field name from a query. I have a number of different reports. I have a query that defines which report I want...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.