Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime Error 91

Status
Not open for further replies.

incagold

Programmer
Mar 21, 2003
54
Hi guys,

Another newbie question. We are trying to use ADO to link
to an ODBC database. We are new to both VB and ADO and just can't seem to get this to work. This is the code we have created. When we run it we get the following error at the conn.Open... line:

Run-time error '91':
Object variable or With block variable not set


Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim i As Integer

conn.Open "DSN=SMV;" & _
"UID=georger;" & _
"PWD=C1701"

Set rs = conn.Execute("SELECT * FROM BUYER")

We have looked through several reference books but can't seem to find a resolution. Any suggestions you may be able to provide would be sincerely appreciated.

Thank you very much in advance,

REF
 

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim i As Integer

Set conn = [red]New[/red] ADODB.Connection
Set rs = [red]New[/red] ADODB.Recordset






Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Thanks Mark,

Appreciate your quick response. That worked just fine. Thank you so much.

REF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top