Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Load a form in datasheet view from another form

Posted on 2004-09-07
4
Medium Priority
?
222 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 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

963 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