Solved

Load a form in datasheet view from another form

Posted on 2004-09-07
4
178 Views
Last Modified: 2012-05-07
I've got a form with a command button that I want to open a separate form in Datasheet view.  All form properties on the second form are set to datasheet specifically with an event procedure under the command button from the first form to load the second as a filtered form. If I put the code "DoCmd.RunCommand acDatasheetview" it  errors out with "datasheet view is not available" after canceling the error the form loads in the form view.  Which can be manually switched to datasheet view.  If I try a macro specifying Datasheet in the "On Load" property of the second form I get an Action Failed window which when halted opens the form in Form view?  What am I missing.
0
Comment
Question by:m_olson57
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 250 total points
ID: 12003440
Hi

you dont say what version of access you are on but this should work ok

DoCmd.OpenForm [form name], acFormDS

Just replace [form name] with the name of the form you want the command button click to open

Cheers

Scott
0
 

Author Comment

by:m_olson57
ID: 12003479
Thanks,  Access 2000.  It was the acFormDS that threw me.  I didn't try it in the correct order.  This works:

    Dim stDocName As String
    Dim stLinkCriteria As String


    stDocName = "frm_Print_Prep_1"

    stLinkCriteria = "[toc_ID]=" & Me![ID]
    DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria

Thanks again!
0
 
LVL 34

Expert Comment

by:flavo
ID: 12003868
just tested

DoCmd.OpenForm "Form1", acFormDS, , "[myID] = 1"

works fine.

Are you sure the form is the right name?

Try just opening a query that is based on the same info - easier and in ds mode :-)

Dave
0
 
LVL 34

Expert Comment

by:flavo
ID: 12003871
woops... now is see it worked...

Carry on..
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

707 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

12 Experts available now in Live!

Get 1:1 Help Now