Solved

ODBC Link failing when opening the database from Code

Posted on 2013-10-31
4
226 Views
Last Modified: 2013-11-12
I have an Access front-end to SQL Server back-end.

Additionally there is an ODBC link to our accounts package, Sage.

When I open the database by double-clicking the icon, it all works fine.

However, I get the database to open automatically from a procedure in Excel to make it easier for the users. When this happens the ODBC link to Sage fails.

Does anyone have any ideas why opening the database from code breaks the link to Sage?

Thanks
0
Comment
Question by:LJKMartin
  • 3
4 Comments
 

Author Comment

by:LJKMartin
Comment Utility
This is the code in Excel:  

Set accObj = CreateObject("access.application")
        Set FSO = CreateObject("Scripting.FileSystemObject")
        If FSO.FileExists(Environ("Userprofile") & "\Desktop\XMLSubmit.laccdb") Then
            AppActivate ("Microsoft Access - XMLSubmit")
            If Not accObj Is Nothing Then
                With accObj
                    .docmd.openform "frmProcessOrders", , , "[f1cSCOrder]= '" & stSCOrd & "'"
                    .UserControl = True
                .Forms!frmprocessorders!txtchecklist.Value = stFailValidation
                End With
            End If
        Else
            Set accObj = CreateObject("access.application")
            accObj.OpenCurrentDatabase Environ("UserProfile") & "\Desktop\XMLSubmit.accdb"
        End If
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
Let's see, you are connecting from Excell to an Access DB to connect to to a SQL DB?

Why not go direct from Excel to the SQL Server?
0
 

Accepted Solution

by:
LJKMartin earned 0 total points
Comment Utility
Thanks for thinking about this.

The administrators of the Sage program suspect that it's being slow to respond, so the problem is nothing that I can change.

Thanks again.
0
 

Author Closing Comment

by:LJKMartin
Comment Utility
The problem is probably to be something outside my control
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now