473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SQL Logon for ODBC Linked table

Hello group:

I guessing there is no way to create an OLEDB linked table in Access
to SQL Server, am I correct? Basically, I've currently migrated one of
my Access database tables to SQL Server, and they are linked via an
ODBC connection. I'm am attempting to make the logon to SQL server
transparent so the users are never prompted to logon. I can easily
create an ADO connection object in a procedure to open a connection
with the proper credentials, and it works ok. However, when users open
the database and the main form opens, the underlying datasource is the
SQL server table, and at that point it prompts them to logon. Is there
anyone for me to accomplish what I want without having to create a
user, system, or file DSN? All users will be connecting via a common
login using SQL Server security; they will not be using a personal
logon id.
Thanks,

James
Nov 12 '05 #1
1 7567
On 5 Oct 2003 23:12:24 -0700 in comp.databases.ms-access,
dr*********@hotmail.com (James) wrote:
Hello group:

I guessing there is no way to create an OLEDB linked table in Access
to SQL Server, am I correct? Basically, I've currently migrated one of
my Access database tables to SQL Server, and they are linked via an
ODBC connection. I'm am attempting to make the logon to SQL server
transparent so the users are never prompted to logon. I can easily
create an ADO connection object in a procedure to open a connection
with the proper credentials, and it works ok. However, when users open
the database and the main form opens, the underlying datasource is the
SQL server table, and at that point it prompts them to logon. Is there
anyone for me to accomplish what I want without having to create a
user, system, or file DSN? All users will be connecting via a common
login using SQL Server security; they will not be using a personal
logon id.


What I do is late bind an ADO object to test the credentials, then if
that function returns true then that's the credentials I stamp onto
all my linked tables' .Connect property.

Function CanOpenSQLDbLB(pstrServer As String, pstrDb As String,
pstrUser As String, pstrPassword As String, Optional pfReportError As
Boolean = True) As Boolean
' Error Trapped: 04/02/2003 09:50:00 Admin
On Error GoTo CanOpenSQLDbLB_Err
' try late binding

Dim objConn As Object
Dim strConn As String
Dim strError As String, lngErr As Long
Const cstrSQLErr = "[Microsoft][ODBC SQL Server Driver][SQL
Server]"

Set objConn = CreateObject("ADODB.Connection")

strConn = strConn & "DRIVER=SQL Server"
strConn = strConn & ";SERVER=" & pstrServer
strConn = strConn & ";APP=" & Application.Name
strConn = strConn & ";WSID=AWorkstation"
strConn = strConn & ";DATABASE=" & pstrDb

objConn.Open strConn, pstrUser, pstrPassword

' Q'PLAGH
CanOpenSQLDbLB = True

CanOpenSQLDbLB_Exit:
On Error Resume Next
objConn.Close
Set objConn = Nothing
Exit Function
CanOpenSQLDbLB_Err:
lngErr = Err.Number
strError = Err.Description
'MsgBox strError
If InStr(1, strError, cstrSQLErr) Then
strError = "Error reported by server" & vbCr & vbCr &
Replace(strError, cstrSQLErr, "")
End If
'Debug.Print strError
Select Case lngErr
Case Else
If pfReportError Then
MsgBox strError, 16, "Error #" & Err & " Attempting to
open server database"
End If
End Select
Resume CanOpenSQLDbLB_Exit

End Function

--
A)bort, R)etry, I)nfluence with large hammer.
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
11
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
7
by: Joe | last post by:
I am using Access 2003 and are linking to an Oracle 9i ODBC datasource (using Oracle ODBC drivers). After linking the tables in Access, I inspect the data contained in the linked tables. For...
3
by: Oren | last post by:
Hi, Is there a way to hide the connection information of linked SQL Server tables from users? It's easy to open a system table and find the connection info, and if the username and password are...
0
by: crypto_solid via AccessMonster.com | last post by:
I have been using a SQL database with a VB5 frontend for about 5 years. Works well. Unfortunately I don't have access to the source code. I was tasked with implementing a "job entry" application...
0
by: Igor | last post by:
An error "ODBC connection to failed" is raised when I am trying to get data from a table in Microsoft Access (97, or 2000) which is actually a linked table to another table in SQL Server 7 . The...
1
by: RLN | last post by:
RE: Access 2003 using WinXP SP2 Problem: When I start up my app I double click either one of my two Oracle tables in the table list, it asks for an id and pass. I need them to be linked at...
1
by: mikerudy | last post by:
I have an 3rd-party application that uses a SQL back-end, but uses Access 2000 (linked tables all using the same DSN) as an intermediary. We recently upgraded from SQL 7 to SQL 2005, which went...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.