Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MS Access Open recordset does not handle dashes

Posted on 2014-12-12
5
Medium Priority
?
281 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 1600 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 400 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

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 …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

704 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