Im getting an error on the Line
VB Code:
  1. Set datPrimaryRS = New ADODB.Recordset
The error reads "Variable Not Defined" but I've used this same code on 10 or so different projects and NEVER had a problem before...

What gives?

VB Code:
  1. Dim sConnect As String
  2.     Dim sSQL As String
  3.     Dim dfwConn As ADODB.Connection
  4.    
  5.     ' set strings
  6.     sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Referral\Referral Rebuild\referrals.mdb;Persist Security Info=False"
  7.     sSQL = "select DrID, SpecialistType, SpecialistLastName, SpecialistFirstName, Address, Fax, Phone, Remarks from Specialists where SpecialistLastName like '" & Text8.Text & "'"
  8.  
  9.    ' open connection
  10.     Set dfwConn = New ADODB.Connection
  11.     dfwConn.Open sConnect
  12.    
  13.     ' create a recordset using the provided collection
  14.     Set datPrimaryRS = New ADODB.Recordset
  15.     datPrimaryRS.CursorLocation = adUseClient
  16.     datPrimaryRS.Open sSQL, dfwConn, adOpenForwardOnly, adLockReadOnly
  17.  
  18.     Set MSHFlexGrid1.DataSource = datPrimaryRS
  19.     MSHFlexGrid1.Refresh
  20.    
  21.     Text9.Text = datPrimaryRS![SpecialistFirstName]
  22.     Text10.Text = datPrimaryRS![SpecialistType]