Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8486749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:02:21+00:00 2026-06-10T21:02:21+00:00

My application written with visual basic 6 and it has an Access database. I

  • 0

My application written with visual basic 6 and it has an Access database. I want to add a VB form and open the database in this form to make db edits the DB in that. I have this code for oppenning:

Dim db As DAO.Database

Set db = DBEngine.workspaces(0).opendatabase("c:\ss.mdb")

I have a form inside that database. This form makes the data insertion process faster. I want to open this access form with my application.
How i should do this??

Note: I have this code that uses Microsoft access 14 object library.

Dim appaccess As Access.Application, dbstr As String

On Error Resume Next
Set appaccess = New Access.Application
Set appaccess = CreateObject("Access.Application")
dbstr = "c:\ss.mdb"
'Or dbstr="c:\my documents\yourfile.mdb
'put the correct path here.
appaccess.OpenCurrentDatabase dbstr
appaccess.DoCmd.OpenForm "aa", acLayout
appaccess.Visible = True

But when i run this code the form appears and after a while it gets disapear. besides using access object library creates some access version conflicts. So, Although it is not necessary but i prefer to do that with ADO object. Anyway, i’ looking for e method to solve my problem.

Thank you for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:02:23+00:00Added an answer on June 10, 2026 at 9:02 pm

    ADO provides methods to interact with various data sources. Although you can use it for Access db files, it doesn’t provide methods to utilize Access forms.

    With your current approach, you use CreateObject to set the object variable appaccess to a new Access application instance, then open your form within that instance. However, when the variable goes out of scope, the Access instance closes and the form disappears.

    You might revise your VB6 code to keep the variable in scope until you’re finished with the Access instance. Unfortunately, I don’t know how to fit that change into the rest of your code, and I’ve never used VB6.

    Alternatively, you could use the Shell Function to start the Access instance, then use GetObject() to set your object variable to that instance.

    With the Shell() approach, you would need to supply the full path to MSACCESS.EXE. You can find the folder where it’s located by reading the registry. Here’s a VBScript sample which does that, and I’m hoping you can adapt it easily for VB6.

    Option Explicit
    Dim MSAccFolder
    Dim RegKey
    Dim WSHShell
    
    RegKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\" _
        & "CurrentVersion\App Paths\MSACCESS.EXE\Path"
    Set WSHShell = WScript.CreateObject("WScript.Shell")
    MSAccFolder= WSHShell.RegRead(RegKey)
    WScript.Echo "MS Access Folder: " & MSAccFolder
    Set WSHShell = Nothing
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple standalone application written in Visual Basic that I'm porting to
I have this application (Windows form application written in Visual C++) from a colleague
I have written a basic Windows Form app in C# that has an embedded
I am maintaining an application that was written in Visual Basic 6.0 and makes
I have written a basic Application for windows mobile 5. It is using visual
Overview I have a Microsoft Word Add-In, written in VBA (Visual Basic for Applications),
I would like to refactor a large legacy application originally written in Visual Basic
I'm having problem with ODBC and an application written with Visual Basic 6 (so
Friend of mine has a problem :). There is an application written in Visual
I have a big application written in Visual Basic 6 and I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.