I thought that opening a Recordset based on a Query was identical to opening a Recordset based on a Table? Apparently not. The below works for Tables in my Database but not for Queries. Any suggestions as to how I can open a Recordset based on my Query named "QryTest"? Here is what I have that gives me an error stating "No value given for one or more required parameters":
Dim db As DAO.Database
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.ActiveConnection = CurrentProject.Connection
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseClient
Set db = CurrentDb
rs.Open "Select * from QryTest ", Options:=adCmdText
If I replace "QryTest" in the last line above with the name of a Table, the Table opens with no problems. Any idea as to why I cannot open a Query?
Thank you for any suggstions.
Jim
Dim db As DAO.Database
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.ActiveConnection = CurrentProject.Connection
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.CursorLocation = adUseClient
Set db = CurrentDb
rs.Open "Select * from QryTest ", Options:=adCmdText
If I replace "QryTest" in the last line above with the name of a Table, the Table opens with no problems. Any idea as to why I cannot open a Query?
Thank you for any suggstions.
Jim