Solved

MS Access Open recordset does not handle dashes

Posted on 2014-12-12
5
276 Views
Last Modified: 2014-12-12
Why does MS Access handle Set rs = CurrentDB.OpenRecordset("qsReindeeers"), but it does not handle Set rs = CurrentDB.OpenRecordset("qs-Reindeeers")

I get too few parameters error...

How can I get MS Access to play nice with dashes ?
0
Comment
Question by:upobDaPlaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Author Comment

by:upobDaPlaya
ID: 40497517
Actually the name is not the issue..I have 2 parameters within the query that properly reference the main and sub form, thus I am confused on why it does not work...  The code is called from within the main form/private sub via a command button
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40497519
Set rs = CurrentDB.OpenRecordset("qs-Reindeeers")

will just do fine..

try doing a compact and repair
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 400 total points
ID: 40497520
I get too few parameters error...

It is not the dashes that is the problem.
qsReindeeers is not the same query as qs-Reindeeers, is it?
qs-Reindeeers contains a parameter in the query.

You cannot open it that way.
You must open a QueryDef object. (qdf)
Then you must supply a correct value for the parameter.
Then you open the recordset
Set rs = qdf.OpenRecordset
0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 100 total points
ID: 40497523
the problem is the query referenced to the subform is not correct

post the sql of the query
0
 

Author Closing Comment

by:upobDaPlaya
ID: 40497533
Query Def worked great..was not aware that a parameter query will not work in VBA unless I use qdef...thx !
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question