473,783 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7824
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.goo gle.com...
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*********@ho tmail.com> wrote in message news:<vp******* *****@corp.supe rnews.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.goo gle.com...
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_RefreshLink s

Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim strConnectStrin g As String, strReadConnectS tring 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.Cur rentProject.Pat h & "\myDsnFileName .dsn"

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

Set fs = CreateObject("S cripting.FileSy stemObject")

strConnectStrin g = ""
fOdbc = False

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

Do While a.AtEndOfStream <> True
strReadConnectS tring = a.ReadLine
If Mid(strReadConn ectString, 1, 1) = "[" Then
If Mid(strReadConn ectString, 1, 6) = "[ODBC]" Then
fOdbc = True
Else
fOdbc = False
End If
Else
If fOdbc Then
If Len(strConnectS tring) > 0 Then
strConnectStrin g = strConnectStrin g & ";" &
strReadConnectS tring
Else
strConnectStrin g = strReadConnectS tring
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;" & strConnectStrin g
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_RefreshLin ks:
Exit Function

Err_RefreshLink s:

MsgBox ("<Some message>")

Resume Exit_RefreshLin ks

End Function

Hope this helps,
--
James Lankford
"KathyK" <ka************ *@nike.com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
"James Lankford" <dr*********@ho tmail.com> wrote in message news:<vp******* *****@corp.supe rnews.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.goo gle.com...
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.goo gle.com...
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.goo gle.com...
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******** *************@n ews.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
16494
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 sqladapter to my SQL Server - Northwind - which I dragged from Server Explorer. I generate a dataset, and Preview Data in the da, works fine. I then enter vb code on Page_Load event: SqlDataAdapter1.Fill(ds) DataGrid1.DataSource =...
2
31133
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 page I get the error: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. I use a connection string in my application in several other pages with no
7
2166
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 '/WebApplication2' Application. ---------------------------------------------------------------------------- ----
2
1629
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 : Not associated with a trusted connection". I'm using integrated security and it works from the IIS server I have set up on my local machine. The connection string I'm using is
5
1886
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 locally, I can connect to the local sql server as well as the sql server on the test server. The IIS settings on both the test server and local machine are the same (anon disabled, use integrated windows auth). Identity impersonate is on in...
1
1632
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 inserting Grid control, SQL datasource control. I am attaching the default Northwind database to this Sql Datasource and binding this to the grid control. When I click test connection on the Sql Datasource, it says conncetion succeded. Now I am...
9
1527
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 following connection in the web.config file <add name="NorthwindConnectionString1" connectionString="Data Source=VHAV16PLAN1;Initial Catalog=Northwind;Integrated Security=SSPI" providerName="System.Data.SqlClient" /> Have following added to...
4
12092
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 running on Windows 2003. If I use SQL authentication, all is fine and dandy. If I want to use windows authentication it gives the above error. My SQL server is set to allow both methods (first thing I checked) and is part of the domain (2nd...
2
2289
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 followed articles on the web and enabled "SQL Server and Windows Authentication" for my SQL Server 2005. But, it does not solve my problem. (It is actually my default setting for my SQL Server)
0
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.