Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2006
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    where condition (Access 2000)

    I am opening the form with the following condition
    DoCmd.OpenForm FormName:="frmContracts",
    WhereCondition:="[ContractNo] = " & Me!ContractNo
    is it possible to express the where condition without writing the words where condition?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: where condition (Access 2000)

    Yes, but then you must add the required number of commas for the arguments you omit:
    <code>
    DoCmd.OpenForm "frmContracts", , , "[ContractNo] = " & Me!ContractNo
    </code>
    When you type DoCmd.OpenForm followed by a space, you'll see the arguments and the order in which they must be specified if you don't name them explicitly.

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: where condition (Access 2000)

    Quite frankly, I've gotten into the habit of using the full option names. It does take a little longer to do; but the code easier to read, and it often prevents errors, which more than offsets the extra time and effort. I do take a little shortcut, however, in always specifying the the formname first, so I'd do it:

    Docmd.OpenForm "frmContracts", WhereCondition:="[ContractNo] = " & Me!ContractNo
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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