connect dns less..?

K

Kent Johnson

Hi all,

I would like to connect to a SQL-server and promt the user with password and
username.
Can I use something like?:

Dim oConn As Object
Set oConn=??
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};" & _
"Server=MyServer;" & _
"DataBase=MyDb"
End Sub

.... what do I have to do?

/Kent J.
 
K

Kent Johnson

John,

Yes, I copied the code below from that site but I don't understand how I
should implement the code in Access.
I just want to run the code, login and after that be able to open tables or
run queries as if I had a ODBC source.

/Kent J.
 
J

John Nurick

I don't have access to a SQL server db and seldom need to use ADO, but
the usual drill seems to be

Dim oConn As New ADODB.Connection
...


John,

Yes, I copied the code below from that site but I don't understand how I
should implement the code in Access.
I just want to run the code, login and after that be able to open tables or
run queries as if I had a ODBC source.

/Kent J.
 
K

Kent Johnson

John Nurick said:
Disregard the "you cant do this" message. It is SPAM (or worse), and
has been showing up all over the newsgroups.

What you ask should be possible. See
http://www.carlprothman.net/Default.aspx?tabid=81

John,

Thanks for your reply! It looks great!
But I'm having problem with; TableExists(ADestinationName)
When I try to compile the code I get a message: "Function not defined"
We have Access 2000 and I'm not sure if TableExists exist as a function.
I can't find TableExists it in the online help.

/Kent J.
 
J

John Nurick

Hi Kent,

TableExists() isn't a built-in function in any version of Access I've
used. But if you do a web search for
access function tableexists
or similar you'll find various versions.
 

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