Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2005

Tip: Looking for answers? Try searching our database.

HELP-Can't open query recordset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alan Baker - 01 Sep 2005 14:50 GMT
9/1/2005

I am having difficulty opening a query recordset for analysis.

The following code opens the query with no problems when the query has
either no criteria or criteria specified as constants. When I attempt to put
a variable in the query criteria, it stops at the line

           .Open qryName, Options:=adCmdTableDirect

with the Run Time Error that says "Too few parameters. Expected x" where x
is the number of variables specified in the criteria

Can you tell me what is wrong and how to fix it?

I will post this to a couple of newsgroups because I'm not sure which one is
appropriate.

If possible, please respond to me directly at abbaker2@comcast.net. as I am
a newbie to these newsgroups.

Many many thanks.

Al Baker

Sub QueryTableLookup()

   Const qryName As String = "qryVerifyDeleteRecords"

   Dim rstqryEquipOne As ADODB.Recordset

   Set rstqryEquipOne = New ADODB.Recordset

   Set rstqryEquipOne.ActiveConnection = CurrentProject.Connection

   With rstqryEquipOne

       .CursorType = adOpenKeyset

       .Open qryName, Options:=adCmdTableDirect

   End With

   DoCmd.OpenQuery qryName, acNormal, acEdit

   rstqryEquipOne.MoveFirst

   LastEquipId = rstqryEquipOne!ID

   Stop

End
Ken Snell [MVP] - 01 Sep 2005 15:53 GMT
see reply in other newsgroup where you've posted this... please do not
multipost the exact same question in multiple newsgroups.. one post usually
is sufficient.

Signature

       Ken Snell
<MS ACCESS MVP>

> 9/1/2005
>
[quoted text clipped - 51 lines]
>
> End
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.