Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2014
    Posts
    27

    Unanswered: Help with simple open form code

    I keep trying to make a statement that just opens a form without any arguements but it keeps telling me I need an expression, I feel like this is a stupid question that is easily solved so any help would be appreciated. I am just trying to use:
    docmd.openform(Search Page,,,,,,)
    but it doesnt want to let me

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    the form name is a required parameter
    DoCmd.OpenForm Method (Access)

    you must delimit the name of the formm as you need to delimit any text literal with either ' or "

    eg
    docmd.openform "myformname"

    I'd strongly suggest you stop using spaces in form, table or column names. its a nasty habit to get into and will cause problems down the line
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    And leave off the trailing commas:

    DoCmd.OpenForm "Search Page"

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Jun 2014
    Posts
    27
    That answered my question thanks, and I will try to stop using spaces in the future

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!

    I should have expanded on my comment

    "...leave off the trailing commas..."

    The rule for Commands is that you only use 'unoccupied' commas as placeholders between parameters, but always end with a parameter, never a comma. So if you had a Command with 5 parameters, and you only need to use Parameters 1, 3 and 4, you'd use

    DoCmd.AnyCommand Parameter1, , Parameter3, Parameter4

    not

    DoCmd.AnyCommand Parameter1, , Parameter3, Parameter4,

    Leaving the Parameter2 empty, and nothing in the Parameter5 place, means that you're accepting the Default for these two parameters.

    Good luck with your project!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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