473,387 Members | 1,541 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,387 software developers and data experts.

Getting Trusted Connection log on when not wanted

Hi and thanks in advance!
I have an Access 2000 front end and a SQL Server 2000 back end. When
the Access main form opens I run code that logs the user on to the SQL
server using the generic read only log on I have created. On some PCs
I am having a problem. The code runs and then displays a Log On box
with the Trusted Connection checked and the users NT logon displayed.
What causes this? Is there a way to correct it?

Thanks!
Kathy
Nov 12 '05 #1
7 7804
Hi Kathy,

I had this same issue a couple of weeks ago. Just running a routine to
login into the server is not enough. I'm presuming you have linked ODBC
tables? I ended up creating a procedure to basically re-link the tables, or
rather, refresh the link to the tables using a file dsn, and running that at
startup. Since the connection is cached for the session, the users won't be
prompted to logon. The file dsn was just the option I selected, but you
could actually embed the connection string in your module code and not have
a dsn file.

I would copy and paste the code, but I'm at home and my project is at work.
If this gives you a good start - great! If you need a sample to go by, let
me know and I'll paste it in the morning.

--
James Lankford
"KathyK" <ka*************@nike.com> wrote in message
news:df**************************@posting.google.c om...
Hi and thanks in advance!
I have an Access 2000 front end and a SQL Server 2000 back end. When
the Access main form opens I run code that logs the user on to the SQL
server using the generic read only log on I have created. On some PCs
I am having a problem. The code runs and then displays a Log On box
with the Trusted Connection checked and the users NT logon displayed.
What causes this? Is there a way to correct it?

Thanks!
Kathy

Nov 12 '05 #2
"James Lankford" <dr*********@hotmail.com> wrote in message news:<vp************@corp.supernews.com>...
James,
If it's not too much trouble I would love to see the code!
Kathy
Hi Kathy,

I had this same issue a couple of weeks ago. Just running a routine to
login into the server is not enough. I'm presuming you have linked ODBC
tables? I ended up creating a procedure to basically re-link the tables, or
rather, refresh the link to the tables using a file dsn, and running that at
startup. Since the connection is cached for the session, the users won't be
prompted to logon. The file dsn was just the option I selected, but you
could actually embed the connection string in your module code and not have
a dsn file.

I would copy and paste the code, but I'm at home and my project is at work.
If this gives you a good start - great! If you need a sample to go by, let
me know and I'll paste it in the morning.

--
James Lankford
"KathyK" <ka*************@nike.com> wrote in message
news:df**************************@posting.google.c om...
Hi and thanks in advance!
I have an Access 2000 front end and a SQL Server 2000 back end. When
the Access main form opens I run code that logs the user on to the SQL
server using the generic read only log on I have created. On some PCs
I am having a problem. The code runs and then displays a Log On box
with the Trusted Connection checked and the users NT logon displayed.
What causes this? Is there a way to correct it?

Thanks!
Kathy

Nov 12 '05 #3
Option Compare Database
Option Explicit

Public Function RefreshLinks() As Boolean

On Error GoTo Err_RefreshLinks

Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnectString As String, strReadConnectString As String, fOdbc As
Boolean
Dim dbTargetDB As DAO.Database
Dim fs, a, retstring
Dim strFileName As String
Dim fLinkFound As Boolean

RefreshLinks = False

' -- If you want to hard code your ODBC link, then you can basically
omit all the code within
' -- Section I, and use a variable to hold your ODBC string for use in
Section II.

' -- Section I --
strFileName = Application.CurrentProject.Path & "\myDsnFileName.dsn"

Const ForReading = 1, ForWriting = 2, ForAppending = 3

Set fs = CreateObject("Scripting.FileSystemObject")

strConnectString = ""
fOdbc = False

Set a = fs.OpenTextFile(strFileName, ForReading, False)

Do While a.AtEndOfStream <> True
strReadConnectString = a.ReadLine
If Mid(strReadConnectString, 1, 1) = "[" Then
If Mid(strReadConnectString, 1, 6) = "[ODBC]" Then
fOdbc = True
Else
fOdbc = False
End If
Else
If fOdbc Then
If Len(strConnectString) > 0 Then
strConnectString = strConnectString & ";" &
strReadConnectString
Else
strConnectString = strReadConnectString
End If
End If
End If
Loop
a.Close
Set fs = Nothing

' -- End Section I

' -- Start Section II
' Loop through all tables in the database.
Set dbs = CurrentDb
fLinkFound = False
For Each tdf In dbs.TableDefs

' If the table has a connect string, it's a linked table.
If Len(tdf.Connect) > 0 Then
' -- I looked for a specific name in this case because I didn't
necessary want
' -- to refresh all my linked tables, in which I had some linked
..xls and .mdb files.
' -- I was looking for a specific table name. Modify as needed.
If tdf.Name = "<somename>" Then
fLinkFound = True
tdf.Connect = "ODBC;" & strConnectString
Err = 0

On Error Resume Next
' Relink the table.
tdf.RefreshLink

RefreshLinks = (Err = 0)
End If

End If
Next

Set dbTargetDB = Nothing

If fLinkFound = False Then
' -- Do something
End If

' -- End Section II

Exit_RefreshLinks:
Exit Function

Err_RefreshLinks:

MsgBox ("<Some message>")

Resume Exit_RefreshLinks

End Function

Hope this helps,
--
James Lankford
"KathyK" <ka*************@nike.com> wrote in message
news:df**************************@posting.google.c om...
"James Lankford" <dr*********@hotmail.com> wrote in message news:<vp************@corp.supernews.com>... James,
If it's not too much trouble I would love to see the code!
Kathy
Hi Kathy,

I had this same issue a couple of weeks ago. Just running a routine to login into the server is not enough. I'm presuming you have linked ODBC
tables? I ended up creating a procedure to basically re-link the tables, or rather, refresh the link to the tables using a file dsn, and running that at startup. Since the connection is cached for the session, the users won't be prompted to logon. The file dsn was just the option I selected, but you
could actually embed the connection string in your module code and not have a dsn file.

I would copy and paste the code, but I'm at home and my project is at work. If this gives you a good start - great! If you need a sample to go by, let me know and I'll paste it in the morning.

--
James Lankford
"KathyK" <ka*************@nike.com> wrote in message
news:df**************************@posting.google.c om...
Hi and thanks in advance!
I have an Access 2000 front end and a SQL Server 2000 back end. When
the Access main form opens I run code that logs the user on to the SQL
server using the generic read only log on I have created. On some PCs
I am having a problem. The code runs and then displays a Log On box
with the Trusted Connection checked and the users NT logon displayed.
What causes this? Is there a way to correct it?

Thanks!
Kathy

Nov 12 '05 #4
You don't have to relink all the tables. Just one is sufficient

James Lankford wrote:

Hi Kathy,

I had this same issue a couple of weeks ago. Just running a routine to
login into the server is not enough. I'm presuming you have linked ODBC
tables? I ended up creating a procedure to basically re-link the tables, or
rather, refresh the link to the tables using a file dsn, and running that at
startup. Since the connection is cached for the session, the users won't be
prompted to logon. The file dsn was just the option I selected, but you
could actually embed the connection string in your module code and not have
a dsn file.

I would copy and paste the code, but I'm at home and my project is at work.
If this gives you a good start - great! If you need a sample to go by, let
me know and I'll paste it in the morning.

--
James Lankford

"KathyK" <ka*************@nike.com> wrote in message
news:df**************************@posting.google.c om...
Hi and thanks in advance!
I have an Access 2000 front end and a SQL Server 2000 back end. When
the Access main form opens I run code that logs the user on to the SQL
server using the generic read only log on I have created. On some PCs
I am having a problem. The code runs and then displays a Log On box
with the Trusted Connection checked and the users NT logon displayed.
What causes this? Is there a way to correct it?

Thanks!
Kathy

Nov 12 '05 #5
Yes, good point - thanks.

--
James Lankford
"Norman Scheinin" <no***************@boeing.com> wrote in message
news:3F***************@boeing.com...
You don't have to relink all the tables. Just one is sufficient

James Lankford wrote:

Hi Kathy,

I had this same issue a couple of weeks ago. Just running a routine to login into the server is not enough. I'm presuming you have linked ODBC
tables? I ended up creating a procedure to basically re-link the tables, or rather, refresh the link to the tables using a file dsn, and running that at startup. Since the connection is cached for the session, the users won't be prompted to logon. The file dsn was just the option I selected, but you
could actually embed the connection string in your module code and not have a dsn file.

I would copy and paste the code, but I'm at home and my project is at work. If this gives you a good start - great! If you need a sample to go by, let me know and I'll paste it in the morning.

--
James Lankford

"KathyK" <ka*************@nike.com> wrote in message
news:df**************************@posting.google.c om...
Hi and thanks in advance!
I have an Access 2000 front end and a SQL Server 2000 back end. When
the Access main form opens I run code that logs the user on to the SQL
server using the generic read only log on I have created. On some PCs
I am having a problem. The code runs and then displays a Log On box
with the Trusted Connection checked and the users NT logon displayed.
What causes this? Is there a way to correct it?

Thanks!
Kathy

Nov 12 '05 #6

I found a fix! I deleted the links to the tables and when I linked them
again I checked the "Save Password" checkbox. Then voila! No more error.
I have never done this before and never had a problem until now.
Interestingly, the problem did not occur on every pc trying to open the
database. So I'm wondering if the real cause is some difference in the
settings on the PC's.

Thanks again for your great advice and code.
Kathy
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #7
Did you create a System or a User DSN?

You know, I don't know if I've ever noticed the Save Password checkbox
before! It's pretty discreet down there in the corner by itself. Thanks,
I'll have to remember that myself.

--
James Lankford
"Kathy Kashmaier" <ka*************@nike.com> wrote in message
news:3f*********************@news.frii.net...

I found a fix! I deleted the links to the tables and when I linked them
again I checked the "Save Password" checkbox. Then voila! No more error.
I have never done this before and never had a problem until now.
Interestingly, the problem did not occur on every pc trying to open the
database. So I'm wondering if the real cause is some difference in the
settings on the PC's.

Thanks again for your great advice and code.
Kathy
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #8

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

Similar topics

2
by: DMS | last post by:
am new to ASP.NET and IIS web applications, but not to SQL databases. I can successfully build Windows apps using Visual Studio that use ADO. However, for Web Forms, I created data connection and...
2
by: Blake Versiga | last post by:
I am pulling my hair out..... I am trying to put a bound data grid on a webform... I have 4 data connections in my server explorer, all of which connect successfully. But when I run the web...
7
by: Ray Valenti | last post by:
I am able to preview this data in the development environment, but when I run the application the error below shows up. How do I set up a Trusted Connection? -Ray Server Error in...
2
by: Paul M | last post by:
Hi, I've just implemented my first application onto a test web server. When the code comes to creating a connection object it throws an error saying the "Login failed for user '(null)'. Reason...
5
by: Mythran | last post by:
I have a test server and a development machine. I have SQL Server installed on both, the installations are pretty much identical. Both servers are in the same domain. When I run my application...
1
by: Developer | last post by:
Dear Group Member, I am sorry if I have posted this query in wrong group, but since this is connected with ASPO.NET2.0, thought of posting here. I am doing a very simple program where I am...
9
by: =?Utf-8?B?UmF5?= | last post by:
Have SQL server on one machine. Have IIS on another machine in same large intranet. Have website in IIS with Basic Authentication turned on and other options deselected. Have webpage (.aspx) with...
4
by: eruth | last post by:
There are loads of post on this, but nothing that seems to cover my exact problem ;) I have an ASP.Net 1.1 web application running on my local machine. I want to connect to an SQL 2005 server...
2
by: gnewsgroup | last post by:
OK, I know this has been a popular question from newbies. But, please don't haste to reply yet. I've googled and tested for a few hours, and cannot have this problem resolved. I have...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.