Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
| Search | Today's Posts | Mark Forums Read
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 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 February 13th, 2006, 06:23 AM
Registered User
 
Join Date: Feb 2006
Location: Beyrouth, , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Open mde or mdb access file from vb6

hi everybody, im new in programming i wish you can help me in my problem:
I have an access application (.mde, and .mdb), and i need to lunch(open) this application from another application in vb6.
can you help me please..its urgent
if you can please show me the details of the solution step by step
thank you

 
Old February 20th, 2006, 01:39 AM
Authorized User
 
Join Date: Feb 2004
Location: , , Denmark.
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default

    Hi
    Here is an example on how I open an mdb from VB6. In this case
    the DB and the application are placed in the same directory.

    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim DbPath As String, Mysql As String

    ' Find path to database
    If Right$(App.Path, 1) = "\" Then
        DbPath = App.Path & "excelentDB.mdb"
    Else
        DbPath = App.Path & "\excelentDB.mdb"
    End If

    ' connect to database

    Set cn = New ADODB.Connection
    cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
            "Data Source=" & DbPath

    ' open a recordset

    Set rs = New ADODB.Recordset
    Mysql = "SELECT * From Tabel1"

    Set rs = cn.Execute(Mysql)

    ' do what you have to do

    rs.Close
    Set rs = Nothing
    cn.Close
    Set cn = Nothing

Hope this can help you-
Cheers
KJ






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create database (.mdb) file in vb6 code mrleokarthik Pro VB 6 13 August 7th, 2009 11:39 AM
re-link tables in a .mde when .mdb does not exist poyserr Access 1 February 22nd, 2007 12:49 PM
Passwrd protected mdb file from Crystl Rpt in vb6 Kaustav Pro VB Databases 1 October 24th, 2005 08:08 PM
Using VB6 SP2 to Open Access 2003 .mdb DWSTERRETT VB Databases Basics 1 June 13th, 2005 08:24 AM
Beginning C# Databases - Can;t open .MDB file saxitalis All Other Wrox Books 0 November 6th, 2003 03:56 PM





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