Hide Datasheet View Using Docmd.Openquery

Hi EE,

I've created several SELECT queries and run them using docmd.openquery.  Unfortunately, the results of these queries are visible in datasheet view.  I'd like to hide the datasheet view and display the final query's results in a form.  Oddly, I have dozens of other SELECT queries in this MDB that aren't displayed in datasheet view.

     'below queries added by JH 11-11-04 to create accurate supplier
     'rfq and single source counts
    DoCmd.OpenQuery ("qry_PRIMARY_SS_AVL") 'excludes offline/estimate/customer from AVL table
    DoCmd.OpenQuery ("qry_SS_MFG_PN") 'builds single source mpn data to query
    DoCmd.OpenQuery ("qry_Supp_SS_RFQ_Counts") 'joins supp name w/ SS count
    DoCmd.OpenQuery ("qry_Final_Supp_RFQ_Count")  'joins supp name w/ ss count and avl table supp count

    DoCmd.OpenForm "frm_Final_Supp_RFQ_Count", acNormal

All of the "DoCmd.OpenQuery..." actions are displayed in datasheet view...argh.  

Any suggestions?

Thank you in advance!
Jay

P.S.  I've tried using the currentdb.querydefs("myquery").execute per another EE post but as my queries are SELECT actions, execute isn't allowed. One other variable:  the queries are querying other query's datasets.
scuttlebuttinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

davidrichardsonCommented:
You dont need to run the select query to display the data on a form, just set the forms datagrid or text box controle source to the query

0
scuttlebuttinAuthor Commented:
Hi David,

Actually, I don't have a problem displaying the results in the form. The problem is that all the queries prior to the OpenForm are displayed in datasheet view and I require that they are hidden.  Does that clarify my problem?

Thanks,
Jay
0
davidrichardsonCommented:
Do you have the DoCmd.OpenQuery in the form open event, if so try removing them
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

scuttlebuttinAuthor Commented:
Nope, the queries are in a function.  

Public Function TurnOffXMLandLot()
On Error GoTo ERROR:

    Forms![frm_main]![Command31].SetFocus
    Forms![frm_main]![SourcingHyperLink].Visible = -1
     Dim X As Integer
     X = MsgBox("Output Files Ready to Upload", vbSystemModal, "Finished")


     'below queries added by JH 11-11-04 to create accurate supplier
     'rfq and single source counts
     Call AVLQueries
'    DoCmd.OpenQuery ("qry_PRIMARY_SS_AVL") 'removes offline/estimate/customer from AVL table
'    DoCmd.OpenQuery ("qry_SS_MFG_PN") 'builds single source mpn data to query
'    DoCmd.OpenQuery ("qry_Supp_SS_RFQ_Counts") 'joins supp name w/ SS count
''    DoCmd.OpenQuery ("qry_Final_Supp_RFQ_Count")  'joins supp name w/ ss count and avl table supp count

    DoCmd.OpenForm "frm_Final_Supp_RFQ_Count", acFormDS
ERROR:
    Debug.Print err.Description
    Debug.Print err.Number
End Function
0
davidrichardsonCommented:
if they are all select querys then you dont need to referance them try removing them
0
scuttlebuttinAuthor Commented:
Sorry, but I pasted the code from an attempt to call the queries when they were added to a module instead.  The current code is minus the Call AVLQueries; and the following 3 DoCmd.OpenQuery lines aren't commented.
0
davidrichardsonCommented:
you must be opening the queries somewhere, find out where and remove the DoCmd.OpenQuery
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scuttlebuttinAuthor Commented:
you are right i am opening them.  i am querying the select queries to build the final dataset.  i thought that i would have to open them to build the data for the final query that is referenced in the DoCmd.OpenForm "frm_Final_Supp_RFQ_Count", acFormDS recordsource.  i'm taking your advice and removing them.  if this doesn't work, maybe i need to run make tables to create my final dataset?
0
scuttlebuttinAuthor Commented:
Apparently there was a fundamental flaw in my docmd.openquery understading; which would explain why there weren't other topics related to this problem here or elsewhere on the web!  Thank you very much David!!
0
davidrichardsonCommented:
No problem
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.