dbTalk Databases Forums  

Connect to database via VBA/DAO/ODBC

comp.databases.gupta comp.databases.gupta


Discuss Connect to database via VBA/DAO/ODBC in the comp.databases.gupta forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Oliver
 
Posts: n/a

Default Connect to database via VBA/DAO/ODBC - 05-19-2005 , 01:59 PM






Hello,
I am trying to connect to a database via VBA.
This is my connection string:

Set dbNorthwind = OpenDatabase("MYDB", False, False,
"ODBC;DSN=SQLBase;UID=sysadm;PWD=sysadm")

When I run this command, it comes up with a login window to the DB.

Can anybody tell me, on how I can avoid this window?

Thanks in advance,
Oliver


Reply With Quote
  #2  
Old   
Oliver
 
Posts: n/a

Default Re: Connect to database via VBA/DAO/ODBC - 05-19-2005 , 02:39 PM






OK, I fixed it on my own, this is the following solution:

Set dbNorthwind = OpenDatabase("MYDB", dbDriverNoPrompt, True,
"ODBC;DSN=MYDB;Database=MYDB;UID=sysadm;PWD=")

But now I have a problem, to get a recordset out of the Database. I run
the following statement:

Set rdShippers = dbNorthwind.OpenRecordset("Select * from myTable")

and I get a message back, that it can not find the table. But it is
there. Can somebody tell me, what I am doing wrong?

Thanks in advance,
Oliver


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.