Run-time Error 91

From: TomKCrmGuy (tomkcrmguy_at_discussions.microsoft.com)
Date: 12/30/04


Date: Thu, 30 Dec 2004 15:29:04 -0800

I have a VB6 application that connects to a SQL Server database, and displays
a crystal report for selected data. The application works fine when logged
into the computer using an account with Administrative privileges. The
application was installed using the Wise Installer. When I log into the
computer using an account with user privileges, the application displays the
following error message:

Run-Time error 91
Object variable or with block variable not set.

The application closes after I acknowledge the error.

The client PC is Windows XP.
The application is written in VB6. I am using Crystal Reports 8.5 developer.

Here is a code snippet:

Private Sub Class_Initialize()
    'Assign application object
    Set Application = CreateObject("Crystal.CRPE.Application")
End Sub

Private Sub ShowReport(inFileName, inMode)
    Dim strPreview As String
    

    Set Report = Application.OpenReport(frmMain.App_Path & "\Reports\" &
inFileName)
    Report.DiscardSavedData 'required for consistent results
    
    'Log on to the ODBC connection
    Application.LogOnServer "pdsodbc.dll", "MYConnection_DSN", , "sa", "sa"

    'Selection formula
        Report.RecordSelectionFormula = "{Company.USERFIELD1} = '" &
frmMain.txtNum1.Text & "'"
        strPreview = "My Company report"

I have spent hours trying to find which registry key or directory permission
needs to be changed, with no success. I have tried to use RegMon, but you
need to be logged in as an administrator to use this.

Does anyone have any ideas?

-- 
Thanks in Advance,
Tom Kaiser


Relevant Pages

  • Problem resolution for calling the Copy method of the OWC11.Spreadsheet object on a Windows 2003 ser
    ... We created a VB6 ... own process space under the network service account, ... Private Sub Class_Initialize ... click the Security tab and clear the checkbox for ...
    (microsoft.public.office.developer.web.components)
  • Re: KeyPress event sub breaks a form
    ... I've been able to duplicate my problem in VB6, ... Private Sub txtScan_KeyPress(ByRef AsciiKey As Integer) ... The problem is that the event procedure is ...
    (microsoft.public.windowsce.embedded.vb)
  • Re: Classes vs. Modules
    ... Dim arrtxtAs TextBox ... Private Sub Text0_LostFocus ... My code has shrunk nearly 30% by switching to VB2005 from VB6, ... strongly typed parameter passing and VB 6 and earlier let you write sloppy ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How to marshal code to the original thread
    ... I didn't spend time on the code you posted, I just included here a complete sample (CS and a VB6 code) to illustrate how I think you could implement your wrapper and to prove you can fire events from abitrary CLR threads to VB6 COM clients using connectionpoint interfaces. ... // pay attention to the class decoration, this is important for connectionpoint interface support. ... Private Sub myCowboy_Touched ... | Willy Denoyette wrote: ...
    (microsoft.public.dotnet.languages.csharp)
  • How to connect Crystal Report 8.5 to VB 6
    ... Im really new at VB and Crystal Report and i know nothing ... In the form customer i've created a command button ... Dim strSQL As String ... Private Sub Form_Load ...
    (microsoft.public.vb.general.discussion)