Opening a recordset using ADO

New Contributor

I've been programming in Access for a number of years using DAO, I must say ADO connections are getting the best of me.  this code did work, now it is not.  Please help, I don't know what I'm doing wrong. 

Dim cnn1 As ADODB.Connection
Set cnn1 = CurrentProject.Connection

Dim rs As New ADODB.Recordset
rs.ActiveConnection = cnn1
rs.CursorType = adOpenForwardOnly
rs.LockType = adLockOptimistic

Dim rsResults As New ADODB.Recordset

Dim strSQL As String


strSQL = "SELECT Immunization.*" & _
" FROM Immunization" & _
" ORDER BY Immunization.ComboField, Immunization.VACCINE_ID, Immunization.VACCINATION_DATE"
rs.Open strSQL

This worked until I added SQL to delete a different  records of a different table prior to the above code. I've commented the delete out.  No luck.   


I'm receiving an error on rs.Open strSQL No value given to one or more parameters. 

I've also tried: 

rs.Open strSQL, cnn1, adOpenForwardOnly, adLockOptimistic, adCmdText


I'm stuck, please what am I doing wrong.  

thanks in advance, Jeanne6452







2 Replies

I figured out what my issue is.  silly me.  

It might help others reading this thread in the future if you stated what your error was and posted the corrected code!