Error when opening Access DB connected to MSDE back-end

G

Guest

I have a .mdb database that I am connecting to an MSDE back-end on a server
via ODBC. Every time I open the database, I get an error that looks like
this:

Connection Failed:
Login Failed for user (null). Reason: Not associated with a Trusted
Connection.

I tried using the following code in an AutoExec macro to solve the problem,
but to no avail:

Dim oConn As New ADODB.Connection
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};Server=OFFICE-DC;DataBase=authorDB Linked
Tables 2003 NoSwitchboard SQL;Trusted_Connection=no;"

What the code does is to open a dialog box so that the user can enter his
username and password. The problem is that it does this AFTER the ODBC error
is displayed. Does anyone have any idea why I keep getting this error?

Any input would be greatly appreciated.

Thanks,

Chris
 
G

Guest

How do you open your mdb?
Are you using the Autoexec macro, or start up form?
When do you ran this code? are you sure there is no operation running
before this code, such as: if you run this code using a form load, and the
form is bound to a table, then you'll get this error when the form loads.
 
G

Guest

Ofer, I tried both using the Autoexec macro to call a funtion to open the
form, and just calling the form from the startup options.

As far as operations, this form uses a linked table on the MSDE back-end as
it's data source, which seems to be the problem. I think the thing to do is
to create an unbound form and NOT use the switchboard manager, as this seems
to be giving me the error.

Thanks for the response.

-Chris
 
G

Guest

Ok, I created an unbound form to use as a switchboard and imported everything
into a new DB so that I have no settings for the swtichboard manager, and no
switchboard items table.

When the application starts, my Autoexec macro runs, which does 2 things:

1) it opens my unbound form, and

2) it uses the code I posted above (in my original post) to open a
connection to the server, which then prompts me with a dialog box that allows
me to input my Username and password.

All good so far.

The problem is, after I have opened this connection to the server, I click
on a button on the form that opens another form, that uses a linked table on
the back-end as its data source.

Now, I get the ODBC error, and when I click OK I get the dialog box for the
SQL Server Login AGAIN, despite the fact that I already established a
connection before I clicked the button.

What am I doing wrong?

Please let me know if you have any ideas.

Thanks,

Chris
 

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