ErikSnoek
Programmer
- Local time
 - Today, 05:18
 
- Joined
 - Apr 26, 2007
 
- Messages
 - 100
 
Hello everyone,
I'm having a problem I can't seem to get around. I have an Access FE with a MSSQL 2005 BE and I'm trying to relink the tables everytime a user opens the database so they don't have to provide login details for the SQL server. I added the code shown below (found it on mcse.ms) in the On Open event of my startup form:
	
	
	
		
Now, the code seems to be updating the links quite well because after running the code I'm able to view the data. However, that is ALL I'm able to do with the data. The account I'm using in the connectionstring has DB_DataReader and DB_DataWriter permissions, so I should be able to write data right? I can't. For some reason all the relinked tables become read-only.
I've done some testing and linked the tables through a DSN and I have the ability to both read and write then. I want to link them DSN-less though so I don't have to create a new DSN on all client computers..
I hope someone knows what I'm doing wrong here!
Thanks in advance,
Erik
 I'm having a problem I can't seem to get around. I have an Access FE with a MSSQL 2005 BE and I'm trying to relink the tables everytime a user opens the database so they don't have to provide login details for the SQL server. I added the code shown below (found it on mcse.ms) in the On Open event of my startup form:
		Code:
	
	
	    Dim Dbs As Database
    Dim Tdf As TableDef
    Dim Tdfs As TableDefs
    Set Dbs = CurrentDb
    Set Tdfs = Dbs.TableDefs
    For Each Tdf In Tdfs
        If Tdf.SourceTableName <> "" Then
            Tdf.Connect = "ODBC;Driver=SQL Server;Server=IT04;APP=Microsoft Office 2003;Database=databasename;Uid=username;Pwd=password;"
            Tdf.RefreshLink
        End If
    Next
	I've done some testing and linked the tables through a DSN and I have the ability to both read and write then. I want to link them DSN-less though so I don't have to create a new DSN on all client computers..
I hope someone knows what I'm doing wrong here!
Thanks in advance,
Erik