Error on opening report from form

Below is the code I am using to open a report based on criteria from
three comboboxes.  The problem is that the report errors as the
WhereCondition is wrong.  Here is the code:

Private Sub btnJC_OpenFull_Click()
On Error GoTo Err_btnJC_OpenFull_Click
Dim stDocName As String
Dim stLinkCriteria As String

If IsNull(cmbHelo) Then
  stLinkCriteria = "[Stage#]" & "=" & """ & cmbStage & """ &
"[Responsibility]" & "=" & """ & cmbResp & """
ElseIf IsNull(cmbStage) Then
  stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" &
"[Responsibility]" & "=" & """ & cmbResp & """
ElseIf IsNull(cmbResp) Then
  stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" & "[Stage#]" &
"=" & """ & cmbStage & """
Else
  stLinkCriteria = "[HELO#]" & "=" & """ & cmbHelo & """ & "[Stage#]"
& "=" & """ & cmbStage & """ & "[Responsibility]" & "=" & """ &
cmbResp & """
End If

stDocName = "rptJC_OpenFull"

DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

Exit_btnJC_OpenFull_Click:
    Exit Sub

Err_btnJC_OpenFull_Click:
    MsgBox Err.DESCRIPTION
    Resume Exit_btnJC_OpenFull_Click

End Sub

Any help would be appreciated.  Thanks!

Terry
0
NeoFax
3/13/2008 6:18:20 PM
access.forms 6864 articles. 2 followers. Follow

4 Replies
537 Views

Similar Articles

[PageSpeed] 31

Use either a Debug.Print, MsgBox or single step to see what you are actually
putting in your WhereCondition string.

NeoFax wrote:
>Below is the code I am using to open a report based on criteria from
>three comboboxes.  The problem is that the report errors as the
>WhereCondition is wrong.  Here is the code:
>
>Private Sub btnJC_OpenFull_Click()
>On Error GoTo Err_btnJC_OpenFull_Click
>Dim stDocName As String
>Dim stLinkCriteria As String
>
>If IsNull(cmbHelo) Then
>  stLinkCriteria = "[Stage#]" & "=" & """ & cmbStage & """ &
>"[Responsibility]" & "=" & """ & cmbResp & """
>ElseIf IsNull(cmbStage) Then
>  stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" &
>"[Responsibility]" & "=" & """ & cmbResp & """
>ElseIf IsNull(cmbResp) Then
>  stLinkCriteria = "[HELO#]" & "=" & """&cmbHelo&""" & "[Stage#]" &
>"=" & """ & cmbStage & """
>Else
>  stLinkCriteria = "[HELO#]" & "=" & """ & cmbHelo & """ & "[Stage#]"
>& "=" & """ & cmbStage & """ & "[Responsibility]" & "=" & """ &
>cmbResp & """
>End If
>
>stDocName = "rptJC_OpenFull"
>
>DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
>
>Exit_btnJC_OpenFull_Click:
>    Exit Sub
>
>Err_btnJC_OpenFull_Click:
>    MsgBox Err.DESCRIPTION
>    Resume Exit_btnJC_OpenFull_Click
>
>End Sub
>
>Any help would be appreciated.  Thanks!
>
>Terry

-- 
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200803/1

0
ruralguy
3/13/2008 6:52:22 PM
On Mar 13, 2:52=A0pm, "ruralguy via AccessMonster.com" <u12102@uwe>
wrote:
> Use either a Debug.Print, MsgBox or single step to see what you are actual=
ly
> putting in your WhereCondition string.
>
>
>
>
>
> NeoFax wrote:
> >Below is the code I am using to open a report based on criteria from
> >three comboboxes. =A0The problem is that the report errors as the
> >WhereCondition is wrong. =A0Here is the code:
>
> >Private Sub btnJC_OpenFull_Click()
> >On Error GoTo Err_btnJC_OpenFull_Click
> >Dim stDocName As String
> >Dim stLinkCriteria As String
>
> >If IsNull(cmbHelo) Then
> > =A0stLinkCriteria =3D "[Stage#]" & "=3D" & """ & cmbStage & """ &
> >"[Responsibility]" & "=3D" & """ & cmbResp & """
> >ElseIf IsNull(cmbStage) Then
> > =A0stLinkCriteria =3D "[HELO#]" & "=3D" & """&cmbHelo&""" &
> >"[Responsibility]" & "=3D" & """ & cmbResp & """
> >ElseIf IsNull(cmbResp) Then
> > =A0stLinkCriteria =3D "[HELO#]" & "=3D" & """&cmbHelo&""" & "[Stage#]" &=

> >"=3D" & """ & cmbStage & """
> >Else
> > =A0stLinkCriteria =3D "[HELO#]" & "=3D" & """ & cmbHelo & """ & "[Stage#=
]"
> >& "=3D" & """ & cmbStage & """ & "[Responsibility]" & "=3D" & """ &
> >cmbResp & """
> >End If
>
> >stDocName =3D "rptJC_OpenFull"
>
> >DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
>
> >Exit_btnJC_OpenFull_Click:
> > =A0 =A0Exit Sub
>
> >Err_btnJC_OpenFull_Click:
> > =A0 =A0MsgBox Err.DESCRIPTION
> > =A0 =A0Resume Exit_btnJC_OpenFull_Click
>
> >End Sub
>
> >Any help would be appreciated. =A0Thanks!
>
> >Terry
>
> --
> RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
> Please post back to this forum so all may benefit.
>
> Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forum=
s.aspx/access-forms/200803/1- Hide quoted text -
>
> - Show quoted text -

Here is what I get when I click the button:

"[HELO#]=3D14704 And [Stage #]=3D" & cmbStage & " And [Lead]=3D" & cmbResp &=

""

This is what it should look like:

"[HELO#]=3D14704 And [Stage #]=3D"4FL" And [Lead]=3D"Flightline""

The problem is the triple quotation marks.  How do I get quotation
marks to show up in VBA?
0
NeoFax
3/13/2008 7:08:54 PM
On Mar 13, 3:08=A0pm, NeoFax <NeoFa...@gmail.com> wrote:
> On Mar 13, 2:52=A0pm, "ruralguy via AccessMonster.com" <u12102@uwe>
> wrote:
>
>
>
>
>
> > Use either a Debug.Print, MsgBox or single step to see what you are actu=
ally
> > putting in your WhereCondition string.
>
> > NeoFax wrote:
> > >Below is the code I am using to open a report based on criteria from
> > >three comboboxes. =A0The problem is that the report errors as the
> > >WhereCondition is wrong. =A0Here is the code:
>
> > >Private Sub btnJC_OpenFull_Click()
> > >On Error GoTo Err_btnJC_OpenFull_Click
> > >Dim stDocName As String
> > >Dim stLinkCriteria As String
>
> > >If IsNull(cmbHelo) Then
> > > =A0stLinkCriteria =3D "[Stage#]" & "=3D" & """ & cmbStage & """ &
> > >"[Responsibility]" & "=3D" & """ & cmbResp & """
> > >ElseIf IsNull(cmbStage) Then
> > > =A0stLinkCriteria =3D "[HELO#]" & "=3D" & """&cmbHelo&""" &
> > >"[Responsibility]" & "=3D" & """ & cmbResp & """
> > >ElseIf IsNull(cmbResp) Then
> > > =A0stLinkCriteria =3D "[HELO#]" & "=3D" & """&cmbHelo&""" & "[Stage#]"=
 &
> > >"=3D" & """ & cmbStage & """
> > >Else
> > > =A0stLinkCriteria =3D "[HELO#]" & "=3D" & """ & cmbHelo & """ & "[Stag=
e#]"
> > >& "=3D" & """ & cmbStage & """ & "[Responsibility]" & "=3D" & """ &
> > >cmbResp & """
> > >End If
>
> > >stDocName =3D "rptJC_OpenFull"
>
> > >DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
>
> > >Exit_btnJC_OpenFull_Click:
> > > =A0 =A0Exit Sub
>
> > >Err_btnJC_OpenFull_Click:
> > > =A0 =A0MsgBox Err.DESCRIPTION
> > > =A0 =A0Resume Exit_btnJC_OpenFull_Click
>
> > >End Sub
>
> > >Any help would be appreciated. =A0Thanks!
>
> > >Terry
>
> > --
> > RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
> > Please post back to this forum so all may benefit.
>
> > Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/For=
ums.aspx/access-forms/200803/1-Hide quoted text -
>
> > - Show quoted text -
>
> Here is what I get when I click the button:
>
> "[HELO#]=3D14704 And [Stage #]=3D" & cmbStage & " And [Lead]=3D" & cmbResp=
 &
> ""
>
> This is what it should look like:
>
> "[HELO#]=3D14704 And [Stage #]=3D"4FL" And [Lead]=3D"Flightline""
>
> The problem is the triple quotation marks. =A0How do I get quotation
> marks to show up in VBA?- Hide quoted text -
>
> - Show quoted text -

I figured it out.  I just had to change the quotes to triple for begin
and quadruple for end.  Now to figure out how to build the
strlinkcriteria if they don't select certain data in the comboboxes.
0
NeoFax
3/13/2008 7:15:46 PM
You are on your way NeoFax. Excellent!

NeoFax wrote:
>> On Mar 13, 2:52 pm, "ruralguy via AccessMonster.com" <u12102@uwe>
>> wrote:
>[quoted text clipped - 64 lines]
>>
>> - Show quoted text -
>
>I figured it out.  I just had to change the quotes to triple for begin
>and quadruple for end.  Now to figure out how to build the
>strlinkcriteria if they don't select certain data in the comboboxes.

-- 
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

0
ruralguy
3/13/2008 7:30:28 PM
Reply:

Similar Artilces:

Excel Progrom Error
Hi there Happy new year to all. I often receive the folowing error message in a box titled "Program Error". EXCEL.exe has generated errors and will be closed by Windows. You will need to restart the program. An error log is being created. The only option is OK which closes Excel. I do not know where the error log is created. I am using Office 2000 Service Pack 3 with Windows 2000 Professsional Service Pack 4. Can anybody throw some light on this error. Thanks in anticipation. Michael What are you doing at the time (i.e. is it consistent)? -- Regards; Rob ----------------...

Sharebuilder account import error
Invalid .qif header error when trying to import .qif file from sharebuilder accounts. Anyone know of a fix or experienced this problem?? I typed a long mail to sharebuilder regarding this issue...still waiting fora reply. Hopefully they will be able to help. Microsoft flat out told me it wasn't their issue and to contact my broker! No help AT ALL. Microshaft..... OMalley ...

2003 Keeps the default workbook open
When I start Excel, it starts up with a blank workbook. If I immediately open a saved file, it closes the blank workbook... All good... except mine has stopped closing the blank one. So I always end up with 2 workbooks open, the one I opened and a blank one that I'm not interested in! Is this a setting? if so where? Can I fix it? thanks... M Did you or someone create a default workbook (ie, Book.xltx or Book.xltm) and save it in "C:\Users\YourUsername\AppData\Roaming\Microsoft\Excel\XLSTART"? On 5/9/2010 4:17 AM, Michelle wrote: > When I start...

DPM2010 RC Errors on secondary server.
We have recently upraded our 2007 SP1 Primary DPM server to 2010 RC and it is working perfectly. I've set up a brand new, fresh Windows 2008 R2 Server for the secondary server, and have told it to protect one of the protection groups on the primary server. Everything works for a little while, but every half hour or so, the DPM service crashes and says: "Connection to the DPM service has been lost. Review the application event log for information about a possible service shutdown. ID: 917" Then asks to restart the administrator console. This kills the ...

ERROR
Hi I am using a spreadsheet in Excel 2002 on Windows XP, for some reason the account numbers (which someone input, along with addresses) have a little green mark in the corner of the cell. I thought it was to show that there is a comment, but it is not. When you click on the cell, a little warning sign shows, saying ERROR - number in this cell formatted as text or preceded by an apostrophe. When I click on the arrow by the warning sign, it says Number stored as text Convert to number Ignore error Edit in formula bar Error checking options Show formula in audinting toolbar Now I looked a...

error, chkdsk
Questio, when I try to open excel or winmx, an error pops up saying chkdsk, so i ran a chkdsk and it doesnt do anything. The error also says corrupted file. In excel I have some important work that I need to open, and it only opens in Turkish, if I change it to English, its a bunch of boxes and letters, its not my work I need. How do I change it back. What excel version are you using? Try to find somebody with 2003 to see if they can open the file. Otherwise you would look for some commercial software that might be of help http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B30...

4.4.7 error
I have problems on one client that they don't recieve all emails from people sending to them. I guess something is wrong in the configuration. When I do a nslookup -type=mx domain.com I just get unautharized answer. Also the ttl time is just 1800 when I do a dns report. Do the guys that handle the dns change this? The people that doesn't get their mail throw get the 4.4.7 error in return. Best regards Jimmy http://support.microsoft.com/kb/555375 -- Ed Crowley MVP "There are seldom good technological solutions to behavioral problems." .. "Surfer&q...

error 0x800CCC0F
Dear Team; I am receiving the following error messages, please assist Could result be sent to lewis.king@riotinto.com regards Lew Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Subject 'brocolli & mushroom stir fry noodle', Account: 'pop.gmail.com', Server: 'smtp.gmail.com', Protocol: SMTP, Port: 995, Secure(SSL): Yes, Error Number: 0x800CCC0F Your server has unexpectedly terminated the connection. Possible causes for this include server p...

delete server...routing master error
hello, I have 2 exchange servers (exch 2003) and i have to delete one of them. I changed all replication etc...(before we had also a 5.5 which is already removed) but when i stop the services and try to remove the server via system manager of my second exchange (the one that will stay) i get an error message that my server that i want to delete is the routing master for that group. How can i make my other server the routing master ? i don't have any site replication (deleted it because not necessary anymore). thnx, Philippe Go to routing groups > first routing group > mem...

Excel error codes translations
hi, Does anybody know where I can find a kind of dictionary for Exce errors? The problem is sometimes I get an error message that is not in Englis and without error code and then looking for the solution I must kno its equivalent in English. Regards, Micha -- Message posted from http://www.ExcelForum.com ...

toolbar, date, services, errors, paste, minimized system restore doesn't work
I have a XP system that the toolbar does not show open programs, services do not seem to load at boot, the date is off by one month, I cannot paste anything that I copy, and system restore does not work. All of these issues started at the same time a few days ago. Has anyone else seen this group of errors? I am trying to resolve and do not know if it is a system update gone bad, or if maybe it is a viruse/malware issue. Please let me know if you had had these problems together and what you did to fix them. There is a very good chance that you are seeing the effects of a hi...

Re: Money 2004
Thanks for the suggestion. I tried unregistering/re-registering the msxml3 DLL, but still no luck. However, knowing the help file topics are local might help with debugging this problem. thanks, randy "Randy" <nospam@hotmail.com> wrote in message news:... > All, > > I've recently upgraded to Money 2004 Premium from 2003 Deluxe. I'm now > finding that I can't view any help topics--I get the "Unable to load topic. > Click here to try again." I've tried all the suggestions posted here and at > other sites: cleared out temporary in...

open attachments via OWA
Have a curious situation. A user is complaining of cannot open attachments via OWA. That's through our company Exchange server (Exchange 2003). Now, on the very *same* laptop she is using, she can get attachments from another company's OWA. Very strange. What is the normal cause of this issue? What attachment types can't see access? (e.g. doc, mdb, exe, com, bat, .etc) The reason that I ask is that OWA under Exchange 2003 can block access to specific attachment types just like Outlook 2003. "Spin" <Spin@spin.com> wrote in message news:3shlhkFoeg86U1@...

how to install .oft files (forms) on a Clustered Exchange?
Hi All I have Exchange 2000 cluster active/passive. How does I install Outlook forms (.oft) files on a Clustered Exchange? Thank you, Jack Black ...

"File Error: Data May Be Lost" error when opening workbook saved in Mac
When I open in Excel 2007 for Windows workbook with charts saved in Mac OS, I see the message "File Error: Data May Be Lost". In Excel 2003 for Windows this message appears as many times as many sheets there are in workbook. Maybe someone knows what's the reason? Unfortunately you haven't provided the info needed... "Mac OS" means very little. The question is "What version of Mac Excel are you using, what file format are the files saved as & what type of content is in the files?" In general, what you're running into is that Excel 2003 &a...

Printing out multiple files from a form
I have a table, tDistrictSub, in Access 2003 that contains various pieces of information. The relevant fields in this table for this problem are: DistrictIncidentNum - the pk (always a 9-digit number, then a dash, followed by another 9 digit number) DistrictIncidentID - the 9-digit number in front of the dash from above I also have a table, tAttachments, that has the following fields: AttachmentID - the pk (autogenerated) DistrictIncidentNum - linked to tDistrictSub Attachment - contains the filename of an attachment. I've created a form, fDistrictSub, that lists information for any...

Macro in Word2007 open another program?
can I use a macro in Word2007 to open and access another program? Yes. But exactly how, depends upon what that program is. See http://word.mvps.org/FAQs/OfficeInterdev.htm and particularly See the article "Control Excel from Word” at: http://www.word.mvps.org/FAQs/InterDev/ControlXLFromWord.htm or the article "Control Outlook from Word” at: http://www.word.mvps.org/FAQs/InterDev/ControlOLFromWord.htm Then there is also the Shell command in VBA. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consu...

Junk E-mail Reporting Tool for Outlook
Microsoft is now offering for download a free "Junk E-Mail Reporting Tool Version 1.0 for Microsoft Office Outlook." It is described this way ... "Microsoft Junk E-mail Reporting Tool submits e-mail to Microsoft when you explicitly choose to do so. If you receive a junk e-mail and want to report it to us for analysis, first select the e-mail in Outlook and then click the junk e-mail button on your tool bar. You will see a pop-up window asking whether you want to report the selected e-mail to Microsoft and its affiliates. When you click "Yes" to confirm that you&...

Technical error
AMEX and Discover are not being sent over to the credit card processor during settlement. I comes up with a "TECHNICAL ERROR". Visa and MC are settling fine. Does anyone know what the problem is?? All are setup as different tranaction types in RMS and ALL authorize fine during the transaction process. Your merchant account is not correctly configured for AMEX & Discover. This is on the bank's side, not RMS. -- Glenn Adams Tiber Creek Consulting http://www.tibercreek.com glenn@tibercreek.com ---------------------------------------------- Please DO NOT respond to me dir...

CObject Private method access error
Hi, I am trying to recompile application that has been developed in VC++ 6.0 with VC++2005.. While compiling, I'm getting the following error.. error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' 1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(553) : see declaration of 'CObject::CObject' 1> c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h(524) : see declaration of 'CObject' 1> This diagnostic occurred in the compiler generated function 'CExcepti...

Error in closing Outlook
Application error ciceroUIWndFrame. The instruction at 0x7e430240 reference memory cannot be written 0x7e42631A Also unable to dial a phone using Outlook. Sanford Take a look here http://support.microsoft.com/kb/323613 -- Peter Please Reply to Newsgroup for the benefit of others Requests for assistance by email can not and will not be acknowledged. "Sanford Aranoff" <aranoff@analysis-knowledge.com> wrote in message news:4B6CD165.E7510293@analysis-knowledge.com... > Application error ciceroUIWndFrame. > The instruction at 0x7e430240 reference me...

set row height upon opening excel
I would like to have the row height set to "20" upon opening or creating a new workbook. You can change the default setting for the column, why not for the height of a row. If there is a way to write a macro that will execute when that workbook is open I would be interested in that also. Thanks If you go to your Personal.xls, and paste this code in the "ThisWorkbook" page, it will automatically set the row height to 20. You may need to add this to the new sheet activate as well. Private Sub Workbook_Open() Cells.Select Selection.RowHeight = 20 End Sub &qu...

Typing message error
I have an Asus Eee PC netbook which came with a Microsoft Works 2007 trial. I'm unable to type anything on a Word document. An error message flashes briefly at the bottom of the screen, "This modification is not allowed because the selection is locked." I'm baffled. Is this a computer problem or a Works problem and how can this be fixed? Thank you. I would be surprised if any system nowadays came with a Works trial; more likely it is an Office 2007 trial (and if it *is* Works, then you're in the wrong discussion group). If the computer is quite new, then...

Can't Erase Tapes: DPM Fails with Error ID:3308
I attempt to erase a tape and every time the DPM console crashes (sometimes two hours into the tape erase) and there is this error: * (000002L4) could not be erased for the following reason: (ID 3308) * DPM service terminated unexpectedly during completion of the job. The termination may have been caused by a system reboot. (ID 910) I can verify that the server has not rebooted. I'm using DPM 2007, with June Rollup, on Windows Server (x64) 2008. The server is a Dell PowerEdge R710. The tape drive is an LTO4 in a Dell PowerVault 124T Autoloader. This error seems to ...

Receive an error message when you try to perform any editing tasks
Hi We have exch2003 cluster and recently we have some note book with Vista, now when we are accessing mailbox through OWA we are getting error when we want to edit (reply, forward) there is article from MS, we want to know does this article also apply to exch clsuter or it is for member server. The artical is http://support.microsoft.com/?kbid=911829 Nagori Not sure what you mean by either exch cluster or member server, but basically you will need to install this patch on your FE and BE exchange servers, including your exch cluster servers. To install exch hotfixes or patches, move...