Solved

MS Access Open recordset does not handle dashes

Posted on 2014-12-12
5
268 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

756 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