Solved

Load a form in datasheet view from another form

Posted on 2004-09-07
4
189 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

895 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

13 Experts available now in Live!

Get 1:1 Help Now