VBA OpenReport Action

In the help documentation for the OpenReport Action, it gives the
following description for the Where Condition:
A valid SQL WHERE clause (without the word WHERE) or expression that
Access uses to select records from the report's underlying table or
query.

Can someone give me an example of a SQL where clause.  I am not very
familiar with SQL, and have the the following:
(qQuery1.tTable1.[Yes-Internal]) <> Yes Or (qQuery1.tTable1.[Yes-
Internal]) Is Null

So that the full action reads:
DoCmd.OpenReport "rReport", acViewPreview, ,  (qQuery1.tTable1.[Yes-
Internal]) <> Yes Or (qQuery1.tTable1.[Yes-Internal]) Is Null

The error I get right now is 424 - Object Required.

Thank you!

0
none
2/20/2008 7:55:33 PM
access 16762 articles. 3 followers. Follow

2 Replies
788 Views

Similar Articles

[PageSpeed] 45

The Where clause has to be a string. As well, you cannot include both the 
name of a query (qQuery1) and the name of a table (tTable1).

Try:

DoCmd.OpenReport "rReport", acViewPreview, , "([Yes-Internal]) <> True Or 
([Yes-Internal]) Is Null"

or, simpler

DoCmd.OpenReport "rReport", acViewPreview, , "Nz([Yes-Internal], False) <> 
True"


-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"none" <rwinter75@yahoo.com> wrote in message 
news:8840b31a-5e6b-4882-837f-5d04d9d072fd@71g2000hse.googlegroups.com...
> In the help documentation for the OpenReport Action, it gives the
> following description for the Where Condition:
> A valid SQL WHERE clause (without the word WHERE) or expression that
> Access uses to select records from the report's underlying table or
> query.
>
> Can someone give me an example of a SQL where clause.  I am not very
> familiar with SQL, and have the the following:
> (qQuery1.tTable1.[Yes-Internal]) <> Yes Or (qQuery1.tTable1.[Yes-
> Internal]) Is Null
>
> So that the full action reads:
> DoCmd.OpenReport "rReport", acViewPreview, ,  (qQuery1.tTable1.[Yes-
> Internal]) <> Yes Or (qQuery1.tTable1.[Yes-Internal]) Is Null
>
> The error I get right now is 424 - Object Required.
>
> Thank you!
> 


0
Douglas
2/20/2008 8:03:43 PM
Excellent!  Thank you very much!
0
none
2/20/2008 8:24:15 PM
Reply:

Similar Artilces:

Help on subscript out of range error (VB6/VBA)
Hi, I want to work with multiple excel workbooks en worksheets using a stand alone VB6 application. 1. First I open and close the workbooks and populate a listbox with sheetnames. 2. Then I select some sheets and fill an Array. (This array contains sheetnames from different workbooks) 3. The last step is to open and close the workbooks again and loop (For Each) through the sheets to get the information I need using the above mentioned array. The only problem is that I receive an "Subscript out of Range" error. This error occurs because I'm attempting tot access a workshee...

Word 2003 VBA to limit options in Inputbox to those in drop down
I have the following macro which works great to make a form drop down list mandatory to fill in: Sub MustFillIn() If ActiveDocument.FormFields("nameDD").Result = "ENTER NAME" Then Do sInFld = InputBox("This field must be filled in, fill in below.") Loop While sInFld = "" ActiveDocument.FormFields("nameDD").Result = sInFld End If End Sub However, the user is free to enter whatever they want in the input box, although the field this fires from if nothing is entered is a drop down- is there any way to ...

VBA Function Reference
Is there a good VBA reference manual or website? I have in mind something like the Principles of Operations manuals (for you dinosaurs who remember Assembly Language) that shows each function with the parameters and a few examples. For which Office program and version? They vary depending on version, and each program has it's own objects and methods. --JP On Mar 18, 10:31=A0am, Square Peg <Square...@Round.Hole> wrote: > Is there a good VBA reference manual or website? > > I have in mind something like the Principles of Operations manuals > (for you dinosaurs who remem...

VBA Functions Excel 2002
Please help. I have created a Function (see below) but regardles of the numbers I enter, I can only get one result to display. That result is Poor-Improving Grrrr! What am I missing here? can anyone help-Please!!! Function EvalAll(OverallEval As Double) If RecentEvaluation >= OverallEvaluation And OverallEvaluation > 4 Then EvalAll = "Good-Improving" ElseIf RecentEvaluation >= OverallEvaluation And OverallEvaluation < 4 Then EvalAll = "Poor-Improving" ElseIf RecentEvaluation >= OverallEvaluation And OverallEvaluation > 4 Then EvalAll = "Good-Impro...

Find function in a macro
I want to set up a macro that searches a column for a value 'X' and then selects the cell right under the cell that contains 'X'. I have been stumped on this for a few days now and would really really appreciate any sort of help or guidance. Thanks a lot! SK --- Message posted from http://www.ExcelForum.com/ Sub Findit() Dim r as Range For Each r in Range("A1:A1000") 'Or whatever yours is If r.Value = "X" Then Range("A" & r.Row+1).Select 'Change A to your column Exit For End If Next End Sub K P.S. You could probably use an...

Quick Camaign (marketinglist)
Hello. If we create one quick campaign email action with a marketinglist over visual studio it create automaticly threefold mail actions. And alsow the mail activity is not send. If we create this by hand everything works fine. We have install rollup 2. Thanks fpr any help. Rene ...

VBA Question
Hi, I have a form with a combobox control that list some sizes. They are: 12 18 20 22 I have another text box for keying a custom size, such as 12'2". What I would like to do is have the combobox default to the next size (in this case 18). Here's the code I have used so far (it does a little more than what I am asking for but to give an idea): Dim MCUST As String MCUST = Me.custwidth If Str(Me.widthck) <> Me.custwidth Or Len(Me.custwidth) <> Len(Me.widthck) Then Me.widthck.Value = Int(Val(MCUST)) + 1 If InStr(Int(Me.widthck) / 2, ".&...

VBA code question?
Hi everyone, I have this simple 3 subs vba code. It runs 8 times and each solution has 24 values that is put in one column of 24 raws. So, the 1st solution found gets written at N2 to N25....and so on. The problem I have is this: The 1st solution that gets written from N2-N25, later it gets removed; just the 1st solution! What could be causing this in the code? Thanks in advance. Option Explicit Option Base 1 Sub Pareto() Dim cell As Range, ModelCounter As Integer, JobNr As Integer Dim ret As Integer Dim ARngSolution As Range Application.ScreenUpdating = False ModelCou...

top N values per group using VBA
Hello, I am trying to follow an example for finding top N values using VBA given at this link: http://support.microsoft.com/kb/210039/en-us#appliesto I've had success with this in the Northwind example database (with my own tables or with Northwind tables) ... But in my own databases (with my own tables) I get "Compile error: User'defined type not defined" with ", db As Database" highlighted in the code when I compile in the module and "Compile error.in query expression '(((Orders.OrderDate)>=NthInGroup([Customers].[CustomerID],5)))'."...

excel vba
I am wondering if it's possible to have text font return to automati (black) when someone enters their name in my password textbox an clicks OK. Here's the layout. I have a userform set up ("Password") which runs o workbook_open. When it comes up the person must enter their name i Textbox1 and click OK in order to view the page. In rows D and E, th text has been manually selected as white in order to hide the contents Is there a way to set up a code in the Password userform so that: Private Sub CommandButton1_Click() If Textbox1.Text = "Mike" Then Sheet1.Range(...

Accessing named ranges in Excel from VBA
Can anyone tell me if and how I can access a named range on a workshee in a VBA procedure? The value of the cell is read from a record with vlookup, I need to b able to access it in a procedure in VBA as input in a new record. Thankx, Bas -- Bas ----------------------------------------------------------------------- Basz's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1234 View this thread: http://www.excelforum.com/showthread.php?threadid=39458 Worksheets("Sheet1").Range("myName") You can get the Value property if it is a single cell, o...

Can't pass string >255 characters to Word document with VBA
Hi everyone, I'm reposting this to see if I can get some additional help as I've been unsuccessful at resolving this problem. I've created a form-based application using Access that helps users automatically fill out a Word form. For the most part, everything is working great EXCEPT when I try to pass any string greater 255 characters in length from Access to a Word text field using VBA. If it's shorter than 255 characters, I never have a problem, and the string passes fine. But when greater than that, the string simply doesn't pass. At the suggestion o...

adding VBA
Hi all-- I am REALLY new at access and found a great VBA code for cascading combo boxes. The only problem is I do not know where / how to install this code. Any suggestions would be VERY greatly appreciated. Thank you in advance Lawrence Dodge Perhaps a sample would be useful. On my website is a small sample database called: CascadingComboBoxes.mdb (http://www.rogersaccesslibrary.com/forum/topic389.html), which illustrates several variations. At the very least, it will show you where to put the code. Look in the Event properties of the combo boxes. -- --Roger Ca...

Drawing in VBA
I have “inherited” a number of legacy worksheets that use, I believe, the pre Excel 97 via VBA drawing object model to plot complex diagrams on a number of sheets. These work perfectly in all versions of Excel up and to Excel 2003, but now give problems when running under Excel 2007 (although the VBA compiles OK) . In Excel 2007 the positioning and rotation of the arcs (and to some extent other drawing items). are totally different in Xl 2007 A simply example of the code I have is show below: Sub DrawArc() With ActiveSheet.Arcs.Add(10, 10, 200, 200) With...

sendkeys action requires utility add in access 2003
I Know that this has been asked before. My question is why it will not pop up on one computer but will on another. The same actions being performed. Any input will be helpful. Thanks Craig "Craig" <Craig@discussions.microsoft.com> wrote in message news:5A3A76CB-9556-4B9D-B85E-39F13771D0C8@microsoft.com... >I Know that this has been asked before. My question is why it will not >pop > up on one computer but will on another. The same actions being performed. > Any input will be helpful. > > Thanks Craig You'll have to give a few more details a...

VBA-generated ScreenTip from an autoshape
I have an autoshape manually attached to a sheet. I want that it can detect whenever the mouse pointer hovers over it, say for example, showing a comment like a toolbar ScreenTip. Any help would be much appreciated. Thanks. -- Osong ------------------------------------------------------------------------ Osong's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=25394 View this thread: http://www.excelforum.com/showthread.php?threadid=389054 ...

Calling GP existing report from vba code
Dear All, Can anyone show me that how to call the GP reports from VBA code. Best Regards, -- Habeeb. ...

VBA Customizations
Is this the correct newsgroup to post Great Plains Report Writer VBA Customizations questions? Don't see any other GP newsgroups. yes - go ahead and post HS "Chris Patten" <ChrisPatten@discussions.microsoft.com> wrote in message news:20652EDD-9EA7-4813-8893-5E51FA72BA1E@microsoft.com... > Is this the correct newsgroup to post Great Plains Report Writer VBA > Customizations questions? Don't see any other GP newsgroups. > > ...

Linking .JPG files using VBA
I have a Table that includes the field "FileLocation" which contains the full file name of various JPG files. I wish to preview those files on an Access Form but I do not wish to manually insert the protographs one-by-one: rather I wish the photo to be displayed or, create an additional OLE Object field in the Table and, using VBA, populate that field with the required linkages. What version of Access is this? In Access 2007, you can bind an image control to a field. Dead simple. Even works even on continuous view forms. In older versions, use the Current event of the form t...

To Generate 500 almost identical VBA Lines?
Hi there I have to create 500 lines of almost identical VBA code. Code is Range("y10").GoalSeek Goal:=ActiveSheet.Range("z10").Value, ChangingCell:=Sheets("FTSE").Range("x10") Range("y11").GoalSeek Goal:=ActiveSheet.Range("z11").Value, ChangingCell:=Sheets("FTSE").Range("x11") Range("y12").GoalSeek Goal:=ActiveSheet.Range("z12").Value, ChangingCell:=Sheets("FTSE").Range("x12") and so on untill Range("y500").GoalSeek Goal:=ActiveSheet.Range("z500").Valu...

A few VBA questions
Hi, I'm currently trying to teach myself VBA. I may have set myself a rather ambitious problem, and I'm wondering if anyone can help. There are a few queries. All the queries center around the same report that is generated by another program - the locations of headers can change column each time the report is generated, and the number of rows change each time. A simplistic view of the report is as follows: A B C 1.Origin Destination %Margin 2. ABC DEF 5 3. GHI JKL 10 4...

Adding a button to the Actions menu for Outlook 2003 for Contacts
Hi, I am working on an add-in for Outlook 2003. I am using VSTO and Visual Studio 2008. I have successfully added buttons to the "Tools" pulldown and the "Actions" pull down for viewing mail. When the user switches to looking at contacts the contents of the "Actions" pull down changes. I want to add a button to this actions pull down, not the one displayed when viewing mail. I have been unable to find the series of calls to give me access to this pull down menu. The ones which work hagve gone through this.application.ActiveExplorer. I h...

merging ranges in VBA
i am running this code, sub page_setup Set SourceWB = Workbooks("book1.xls") With SourceWB.Sheets("sheet1") ' alot of other coding, but this seems to be the problem area .Range("K2:L2").Merge .Range("K3:L3").Merge .Range("K4:L4").Merge .Range("K5:L5").Merge .Range("K6:L6").Merge .Range("K7:L7").Merge end with end sub ________________________________ sub page_info Set SourceWB = Workbooks("book1.xls") With SourceWB.Sheets("sheet1") .Range("K7").Value = FormatPercent(.Range(&q...

Linking formulas to text boxes in VBA
Hi, I just posted this to the programmers section, but I think those folks are into more serious things than this! I'm newly experimenting with VBA, so apologies if this is a stupid question. Any help much appreciated! I have a For - Next loop that creates a formula linking a cell in an 'input sheet' ("Key") to a cell in any one of 200 sheets. For cells, this is no problem, using: For i = 1 to 200 Worksheets(i).Range("c2").Formula = "=Key!B" & i Next i My problem comes when I try to do the same with some text boxes that are in each of the 200 s...

UserForm loaded twice in VBA Project Explorer
Hello, For some reason my userform is loading twice in Project Explorer. I believe it is causing an out of memory error when I attempt to add/edit code on the userform. Does anyone know why it does this and how I can make it stop? Thank you for your assistance Just right click on the userform name of the dupicated userform you want to remove and click remove. If this helps, let me know by clicking "YES" below. -- Cheers, Ryan "OffDev" wrote: > Hello, > > For some reason my userform is loading twice in Project Explorer. > I beli...