Need more, need help now?
- - - - - - - - - - - - - - - - - - pay-as-you-go support - no contract - tenth of an hour billing - expert help - fast service - no call queues
Need integration?
- - - - - - - - - - - - - - - - - - with your shipping system - website - invoicing system - crm - cms - manufacturing - order import - back to back orders..
Need a report?
- - - - - - - - - - - - - - - - - - Excel reporting that pulls data from Sage - custom layouts - layouts that change adapt to your brands and/or for drop shipping.
Want web hosting?
- - - - - - - - - - - - - - - - - - Your own domain name - email - a shop - wordpress - woo commerce - ticket systems - help desks - forums - portals

SAGE ODBC

Sage 50 general help forum - Free help and support for all general issues
Post Reply
owen_legend
User
User
Posts: 9
Joined: 07 Dec 2015, 16:57
Sage Version: v2016 22 UK/Europe/Africa

SAGE ODBC

Post by owen_legend » 25 Feb 2016, 11:30

Hey Guys,

Just a quick (but apparently complicated one).

I connect SAGE to access through linked tables and run queries on data which are then called from Excel.

So Excel connects to Access which connects to SAGE.

The issue is that whenever I refresh the query in Excel it requests the ODBC user name and password every time which isn't ideal for when I need to have other users connect - I can't give out the SAGE login details really.

If i run queries in excel directly to SAGE - I can put the user name and password in the connection string and "remember password" so that Windows inputs the credentials for me automatically on refresh.
However this doesn't seem as simple in Access.

I have tried using VBA and create a module with the following code:

Code: Select all

Sub PrintTabledef()


Dim tdf As TableDef
Dim db As Database

    Set db = CurrentDb

    For Each tdf In CurrentDb.TableDefs
        If tdf.Connect <> vbNullString Then
           Debug.Print tdf.Name; " -- "; tdf.SourceTableName; " -- "; tdf.Connect
        End If
    Next
End Sub

Sub ChangeConn()


    Set db = CurrentDb
    Set tdf = db.TableDefs("TableName")
    tdf.Connect = "ODBC;DSN=SageLine50v22;UID=xxxx;PWD=xxxx;"


End Sub
So the first code (PrintTabledef()) prints the connection strings and the second code (ChangeConn()) is meant to amend them - but it doesn't - the code executes but I guess on refresh it removes the credentials.


Is there any other way around this? Can I get Access to "remember" credentials and automatically input them?

User avatar
brucedenney
Site Admin
Site Admin
Posts: 4648
Joined: 28 Feb 2006, 09:56
Sage Version: v30 UK/Europe/Africa

Re: SAGE ODBC

Post by brucedenney » 25 Feb 2016, 12:18

VBA is the way to embed credentials.
For just about anything Sage :- Discount subscriptions, pay-as-you-go support, application integration, reports, layouts, linked excel spreadsheets, analysis or any other help making life with sage easier/less time consuming Contact me.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests