VBS Userform code to load Access

ScottyFl

New Member
Joined
Dec 19, 2014
Messages
18
Hello
FRUSTRATED...

I am trying to load Access 2013 through my userform in 2013 Excel using VBA.

I have downloaded and tried the following pieces of code..
Code:
      'Access object
      'Dim appAccess As Object
      'create new access object
      'Set appAccess = CreateObject("Access.Application")
      'open the acces project
      'Call appAccess.OpenCurrentDatabase("R:\Sample.accdt")
      'appAccess.Visible = True
      
      'the path to create the new access database
'Dim strPath As String
'an Access object
'Dim objAccess As Object


'strPath = "R:\NewDB"
'Set objAccess = CreateObject("Access.Application")
'Call objAccess.NewCurrentDatabase(strPath)
'objAccess.Quit




'Access object
'Dim appAccess As Object


'create new access object
'Set appAccess = CreateObject("Access.Application")
'open the acces project
'Call appAccess.OpenCurrentDatabase( _
'"R:\NewDB.accdb")
'appAccess.Visible = True


'Dim db As Access.Application
 'Set db = New Access.Application
'db.OpenCurrentDatabase "R:\NewDB.accdb"
'db.Application.Visible = True


'Global oApp As Object


    'Sub OpenAccess()
    'On Error Resume Next


        'Dim LPath As String
        'Dim LCategoryID As Long
        'Dim DATABASE As String
        'Static oApp As Access.Application
        
        'DATABASE = "R:\NewDB.accdb"


        'Set oApp = GetObject(, "Access.Application")
        'If (Err.Number <> 0) _
       ' Or (oApp.CurrentDb.Name <> DATABASE) Then
        
        'Set oApp = Nothing
        'Set oApp = CreateObject("Access.Application")
            'oApp.Visible = True
            'oApp.OpenAccessProject "R:\NewDB.accdb"
            
            'Set oApp = CreateObject("Access.Application")
            'oApp.Visible = True
            'oApp.OpenCurrentDatabase DATABASE
            
       'End If


        'Open form called Categories filtering by CategoryID
        'LLocation = Range("A2").Value
        'oApp.DoCmd.OpenForm "ReviewEBDOrdersFrm", , , "[Circuit]=" & "'" & LLocation & "'"


strdb = "R:\NewDB.accdb"
Set appAccess = CreateObject("Access.Application")
appAccess.Visible = True
appAccess.OpenCurrentDatabase strdb
appAccess.DoCmd.OpenForm
Set appAccess = Nothing
Many and many different attempts.

Name of my database is... "R:\NewDB.accdb"

most of the code loads Access then it immediately closes down.

I have a master control panel userform that drives my excel file. I want to click on a button and Access loads up.. AND STAYS OPEN. One of the pieces came close except when I closed my userform access followed.

FRUSTRATED...

Scott
 
Last edited by a moderator:
Thanks

Happy holidays to you and yours.

Scott

Glad you got a solution.:)

One thing I'd like to say though is that this forum is free, the members here aren't paid and we give our free time to try and help people.

PS This is probably the best forum to use for this kind of help.
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I have another rather interesting issue.

I run everything from a userform. When I go to another sheet via a command from my userform the "X" close button, the scroll function does not work. If I go to the bottom of my sheet and click on another sheet then click back, then the "X" and scroll works. This is rather annoying to say the least.

Interesting?

Scott
 
Upvote 0
What code, if any, are you using to goto the other sheet?

Also, are you displaying the userform modally or modeless?
 
Upvote 0
Here is a sniblet of the VBA that transfers to another sheet

ElseIf IssueForm.ReportReviewComboBox.Value = "Net Agency Summary" Then
Sheets("Net Agency Summary").Select
Range("a1").Select
 
Upvote 0

Forum statistics

Threads
1,221,556
Messages
6,160,476
Members
451,649
Latest member
fahad_ibnfurjan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top