Results 1 to 3 of 3

Thread: What's going on!!!

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46

    Angry

    I have an app that keeps giving me the following error message and I want it to quit!!!!!

    Run-time error '2501'
    The OpenReport action was canceled.

    I know why it is giving the error to me here goes:
    I am using access as my backend. I created 1 query and 1 report in access. I am from my vb app printing the 1 report using the data from the 1 query. The query ask the user for information, simply a client number. However if I press cancel on the input box for the query I get this crazy error. Is there anyway and can just cancel it and be done with it!!

    Thanks.

  2. #2
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606
    Post your code it will be easier to help ya!!!

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    46
    Public Sub getTransactionLog()
    Dim strDB As String
    Dim strReportName As String

    ' Initialize string to database path.
    strDB = "C:\My Documents\Sara\sara.mdb"

    ' Initialize string to Report name.
    strReportName = "rptTransactionLog"

    PrintAccessReport strDB, strReportName
    End Sub

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    'Print out Access Report
    Sub PrintAccessReport(strDB As String, strReportName As String)


    ' Return reference to Microsoft Access Application object.
    Set appAccess = New Access.Application

    ' Open database in Microsoft Access.
    appAccess.OpenCurrentDatabase strDB

    ' Print report.
    appAccess.DoCmd.OpenReport strReportName
    appAccess.CloseCurrentDatabase
    Set appAccess = Nothing

    End Sub
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Once I hit cancel on the query it craps out at this line:

    appAccess.DoCmd.OpenReport strReportName

    Thanks.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width