Gustav Brock
Gustav at cactus.dk
Tue Apr 3 05:28:40 CDT 2007
Hi Sander I don't think you can cut the connection belonging to CurrentProject ... that would be like kicking your own feet away. I guess you need to create a new Connection object and then use that for whatever your purpose is. /gustav >>> accessd666 at yahoo.com 03-04-2007 11:24:39 >>> Hi, I need to reset the CurrentProject.Connection.ConnectionString value for my ADP (2002) When I try: CurrentProject.Connection.ConnectionString = strConnString I get the error: Operation is not allowed when the object is open. This is true because the following returns false: ?CurrentProject.Connection.State = adStateClosed So before setting the new connectstring property I try to close the connection but none of the below seem to work, although they do NOT return an error! Application.CurrentProject.CloseConnection CurrentProject.CloseConnection CurrentProject.Connection.Close set CurrentProject.Connection = nothing (?? just trying) Goal: How can I set a new connect string? Regards, Sander PS: I asked this before and got some good answers. Throughout the app several functions are used that use CurrentProject.Connection. These are called hundreds of times!! I do not want to modify that code.