Problem with DSN-less connection

K

KevinCB

Hi

I have used the code form the microsoft support site to try and create a
DSN-less connection to SQL Server, but I can't seem to get it working. I keep
getting the following error message on the CreateDSNConnection in the form
open event:

"Compile error: Expected variable or procedure not module"

Does anyone have a solution to this?

Thanks
 
T

Tom Wickerath

Hi Kevin,

It sounds like you might have a procedure (subroutine or function) that has
the same as a module:

http://support.microsoft.com/?id=312851


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hi

I have used the code form the microsoft support site to try and create a
DSN-less connection to SQL Server, but I can't seem to get it working. I keep
getting the following error message on the CreateDSNConnection in the form
open event:

"Compile error: Expected variable or procedure not module"

Does anyone have a solution to this?

Thanks
 
K

KevinCB

Thanks for the reply, and yes that was the problem.

Just another quick question regarding the DSN connection.
I would like it to stop asking for the username and password when connecting
to the server.

I believe this is possible using the OpenDatabase method, but whereabouts
would I put this to get it to work, in the module or on the form?

Or is it possible to do it throught the DBEngine.RegisterDatabase?

Thanks
 
T

Tom Wickerath

Hi Kevin,

Glad to hear that you got it working. Your next question should be reposted;
it's really not related to your original question. I'm not an expert in the
area of connections to SQL Server, but I believe you want to use what is
known as a Trusted Connection. This is (I think) where SQL Server uses the
Windows logon credentials. My personal advice is to not attempt to embed a
username and/or password anywhere in your code or connection strings, if you
are not using a Trusted Connection. That would be a huge security breech, and
the DBA for your SQL Server would likely not be too happy with you. If you
are not using Trusted Security, then your users should be entering a separate
username and password each time they need to use your application.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________


:

Thanks for the reply, and yes that was the problem.

Just another quick question regarding the DSN connection.
I would like it to stop asking for the username and password when connecting
to the server.

I believe this is possible using the OpenDatabase method, but whereabouts
would I put this to get it to work, in the module or on the form?

Or is it possible to do it throught the DBEngine.RegisterDatabase?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top