Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2004, 07:28 PM
Authorized User
 
Join Date: Jun 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default DoCmd.Open Report Bug - Please help!

Has anyone experienced this problem? I am trying to get a report to open based on a combo box value, in this case, project number. My code is as follows:

Private Sub cmdPreviewCatalog_Click()
On Error GoTo Err_cmdPreviewCatalog_Click

    Dim stDocName As String
    Dim strWhere As String

    strWhere = "ProjectNumber = '" & cboProjectNumber & "'"



    stDocName = "rptArtifactCatalog"
    DoCmd.OpenReport stDocName, acViewPreview, , strWhere


Exit_cmdPreviewCatalog_Click:
    Exit Sub

Err_cmdPreviewCatalog_Click:
    MsgBox Err.Description
    Resume Exit_cmdPreviewCatalog_Click

End Sub

When I run this application at my home, the report opens and there are no problems. However, when running this event procedure at my client's office, my entire database, and Microsoft Access, closes. I have developed the database on Access 2003, and my client owns Access XP. We both have Windows XP as our O/S.

Has anyone seen this problem? If so, what sort of patches/hotfixes to I need to download in order to get the application to work at my client's office?

Thank you in advance.

Brian in Raleigh
 
Old June 29th, 2004, 02:43 AM
Authorized User
 
Join Date: Jul 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

2 things spring to mind:

1 Are your library references the same at home and office and are they in the same priority order.

2 Is the combo box a single or multi column? If multi column you may have to reference the selected value as an index.

Cheers Ray
 
Old June 29th, 2004, 03:45 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

First, you should have the WHERE statement written like this:

strWhere = "[ProjectNumber] = '" & cboProjectNumber & "'"

Note the brackets. Perhaps the lack of brackets is triggering an error that's causing the dB to just break down and crash for no apparent reason. Sometimes the reason is as convoluted as that!


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
excel workbooks.open bug smiler_00 Pro VB 6 0 May 9th, 2007 05:24 AM
Bug or no to bug learning C using VS.Net to compil tesh All Other Wrox Books 0 February 14th, 2007 01:06 PM
Syntax Error -- BUG REPORT Solved dparsons MySQL 1 October 5th, 2006 01:38 PM
add image to report and send with DoCmd.SendObject marcin2k Access VBA 1 February 22nd, 2005 12:48 PM
Error to open Report codaman Pro VB 6 0 December 11th, 2003 12:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.