Results 1 to 1 of 1

Thread: VB6 SP6 Use ACCESS 2003 Report

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2010
    Location
    New Zealand
    Posts
    207

    VB6 SP6 Use ACCESS 2003 Report

    Hi VB6 Good Guys,

    I need your help. Please help me.
    I been asked to change legacy VB6 application to use ACCESS Database and to print ACCESS Report via VB6 application.

    I was asked also not to display PopUp ACCESS Security Warning as per attached document. And also having problem how to insert SQL String via VB6 into ACCESS Report RecordSource as well.


    Here are the VB6 Coding

    Code:
    Dim objAccess As access.Application
    Dim dbName As String
    Dim rptName As String
    Dim strSql As String
    
    
    Private Sub Form_Load()
          Set objAccess = CreateObject("Access.Application")
          dbName = "F:\SalesDept\SalesDataBase.mdb"
          rptName = "RptSalesTrans "  
    End Sub
     
    Private Sub BtnPrint_Click()
    
       strSql = "SELECT OrderID, firstName, LastName, Address FROM TblSalesTrans; "
               
       With objAccess
             .DoCmd.SetWarnings False <-- not working   
             .OpenCurrentDatabase (dbName)
             .Visible = False
          
             .DoCmd.OpenReport rptName, , , strSql
             .DoCmd.PrintOut
             .CloseCurrentDatabase
       End With
          
          objAccess.Quit
          Set objAccess = Nothing     
    End Sub
    How to prevent the PopUp Security Warning Dialog screen appearing and
    How to insert SQL string into ACCESS Report via VB6 application

    Thank you.

    Cheers,
    Lennie
    Attached Files Attached Files
    Last edited by Lennie; Aug 12th, 2010 at 04:16 AM. Reason: typo error

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