Solved

MS Access Open recordset does not handle dashes

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now