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
How to prevent the PopUp Security Warning Dialog screen appearing andCode: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 insert SQL string into ACCESS Report via VB6 application
Thank you.
Cheers,
Lennie






Reply With Quote