Results 1 to 5 of 5

Thread: Docmd.openform

  1. #1
    Join Date
    Sep 2003
    Posts
    6

    Unanswered: Docmd.openform

    I want to open a form by pressing a button that runs the Docmd.Openform method but to open the form in Datasheet view. Setting the view parameter of the form to Datasheet works only if the form is double-clicked.OPenform opens it in Formview.
    What is the Openform syntax and how I can choose Datsheet view?
    Thanks in advance.
    Mike Karabelas.

  2. #2
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    Create a query based on the table that holds the information for the form. Then when you click the command button try this on the OnClick event.

    Private Sub Command1040_Click()
    DoCmd.OpenQuery "YourQueryName", acViewNormal
    EndSub

  3. #3
    Join Date
    Sep 2003
    Posts
    6

    Docmd.openform

    Originally posted by billjov
    Create a query based on the table that holds the information for the form. Then when you click the command button try this on the OnClick event.

    Private Sub Command1040_Click()
    DoCmd.OpenQuery "YourQueryName", acViewNormal
    EndSub
    The thing is that the form i want to be opend in datasheet view icludes a subform so it takes data from 2 tables(linked on 1 to 1 basis).If i use a query with the fields of both tables, in the form (based on this query) will appear only those records from the 1st main table from who there is some data in the linked records on the 2nd table. So i can't do that because in this form i want all records from table1 to be visible.

  4. #4
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    In your query you will need to include the 2nd table.

    Open the query in design view and add table 1 and table 2. then select all the fields that you want to appear in the query.

  5. #5
    Join Date
    Nov 2003
    Location
    Europe
    Posts
    369

    Re: Docmd.openform

    Originally posted by karabelas
    I want to open a form by pressing a button that runs the Docmd.Openform method

    What is the Openform syntax and how I can choose Datsheet view?
    I need to open a form read-only in datasheet view, instead of advicing on other possibilities, can someone please just provide the correct alternative to what the commandbutton wizard automatically does to display in form view?

    (DoCmd.OpenForm stDocName, , , stLinkCriteria)

    kedaniel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •