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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where is cn supposed to be defined? 1

Status
Not open for further replies.

sanders720

Programmer
Aug 2, 2001
421
US
Where is cn supposed to be defined?


Private Sub cmdGetData_Click()

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim connString As String
Dim sql As String
Dim C As Integer
Dim R As Integer


connString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\deepblue\EngineeringBOM\VIA-WD User Files\" & cboJobNo.Value & ".mdb;" & _
"Persist Security Info=False"

MsgBox connString

cn.ConnectionString = connString

sql = "SELECT CAT, DESC1, DESC2, MFG, LOC FROM tblComp WHERE LOC = " & Me.cboSubAssy.Value
Debug.Print sql

Set rs.ActiveConnection = cn

With rs
.Open sql, cn, adOpenForwardOnly, adLockReadOnly
Debug.Print "eof = "; .EOF
While Not .EOF
Debug.Print "field name = "; rs.Fields(0).Name
Debug.Print "field value = "; rs.Fields(0).Value
rs.MoveNext
Wend
.Close
End With

Set cn = Nothing


End Sub
 
After doing some research, I've come to realize that this was a really dumb question!
 
Don't worry about it. It's only dumb if you ask it after your research. LOL Durkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top