Solved

ODBC Link failing when opening the database from Code

Posted on 2013-10-31
4
257 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
ID: 39614395
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.
ID: 39615977
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
ID: 39630763
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
ID: 39641074
The problem is probably to be something outside my control
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

830 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