Results 1 to 8 of 8
  1. #1
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26

    double click to open

    i dont know what am i doing wrong but suddenly double click on a field and open another form with a record does not work anymore:

    Private Sub ordrep_DblClick(Cancel As Integer)
    DoCmd.OpenForm "Orders", , , _
    "[orders.ordrep]=" & "'" & Forms![customerorders].ordrep & "'"

    DoCmd.Close acForm, "customerorders", acSaveNo
    End Sub

    ... on double click is giving me error "runtime error 2501. the open form action was canceled"

    why?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    DoCmd.OpenForm "Orders", , , "[ordrep]= '" & Forms![customerorders].ordrep & "'"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    i actually tried that as well but the error remains... what's dashing is that in the database i have used this code tens of times and works but with this something is wrong :S

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The error is generic, but my guess is that something is spelled wrong or the data type isn't text. Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    found the problem... its actually very bizarre however

    (error) ordrep & "'"
    (fix) ordrep & ""

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That field must be numeric. See here for the syntax for different data types:

    BaldyWeb wherecondition
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    I never knew about the # syntax. Thanks for the quick link

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-15-2012, 05:41 PM
  2. Replies: 10
    Last Post: 02-20-2012, 11:25 AM
  3. Tables/Queries/Etc Won't Open on Double Click
    By William McKinley in forum Access
    Replies: 3
    Last Post: 07-27-2011, 07:45 AM
  4. On Double Click go to Subform
    By Theremin_Ohio in forum Access
    Replies: 2
    Last Post: 03-30-2011, 08:03 AM
  5. Opening another form by double click
    By chrisjack001 in forum Access
    Replies: 1
    Last Post: 10-13-2010, 02:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums