Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strConnection As String
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My2000HW.MDB;Persist Security Info=False"
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.ConnectionString = strConnection
cn.Open
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockReadOnly
rs.ActiveConnection = cn
Const strSQL As String = _
"SELECT Salesmen.SalesFirst," _
& " Salesmen.SalesLast," _
& " Salesmen.SalesID," _
& " Customers.FirstName," _
& " Customers.LastName," _
& " Customers.Custno," _
& " Customers.SalesID" _
& " FROM Customers c INNER JOIN Salesmen s" _
& " ON c.SalesID = s.SalesID" _
& " WHERE c.State = 'CA'" _
& " ORDER BY c.SalesID"
rs.Source = strSQL
rs.Open
'Err.Number = -2147217904 = No value given for one or more required parameters.
'Never gets here
rs.MoveFirst
While Not rs.EOF
List1.AddItem rs![customers.SalesID]
rs.MoveNext
Wend
Dim rs As ADODB.Recordset
Dim strConnection As String
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My2000HW.MDB;Persist Security Info=False"
Set cn = New ADODB.Connection
cn.CursorLocation = adUseClient
cn.ConnectionString = strConnection
cn.Open
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockReadOnly
rs.ActiveConnection = cn
Const strSQL As String = _
"SELECT Salesmen.SalesFirst," _
& " Salesmen.SalesLast," _
& " Salesmen.SalesID," _
& " Customers.FirstName," _
& " Customers.LastName," _
& " Customers.Custno," _
& " Customers.SalesID" _
& " FROM Customers c INNER JOIN Salesmen s" _
& " ON c.SalesID = s.SalesID" _
& " WHERE c.State = 'CA'" _
& " ORDER BY c.SalesID"
rs.Source = strSQL
rs.Open
'Err.Number = -2147217904 = No value given for one or more required parameters.
'Never gets here
rs.MoveFirst
While Not rs.EOF
List1.AddItem rs![customers.SalesID]
rs.MoveNext
Wend