Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Bristol, Avon, England
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open form by doubleclicking datasheet (2000)

    I want to be able to open a form (column view - easier to edit etc...) by double clicking ANY field in a form in datasheet view.

    I have tried using the code below......

    Private Sub Form_DblClick(Cancel As Integer)

    DoCmd.OpenForm "FmDetail", , , "[ID] = " & Me![ID]

    End Sub

    ....but you have to click on the record selector rather than 'in' the data itself.
    I want to be able to click any field in a given row and for the editable for to open up on that record.
    I don't wan't to have to put a double click event on every field.

    Is there an easy way to do this?

    Thanks

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

    Re: Open form by doubleclicking datasheet (2000)

    I'm afraid you *do* need to have a double click event handler for each control in the detail section. You could do it like this:
    1. <LI>In the form module, create a function that opens the other form:

      Private Function OpenEditForm()
      DoCmd.OpenForm "FmDetail", , , "[ID] = " & Me![ID]
      End Function

      <LI>Select all controls in the detail section (either by Click + Shift Click, or by dragging a rectangle through them, or by clicking/dragging in the vertical ruler).
      <LI>Activate the Properties window.
      <LI>Activate the events tab.
      <LI>In the On Dbl Click event, enter the expression

      =OpenEditForm()

      <LI>Press Enter or click in another event.
      <LI>Close and save the form.
    This way, you don't have to write a separate event procedure for each control. But ... you'll have to remember (or better, document) what you've done! Otherwise, later on you may not know any more why the controls behave as they do - this is not as self-documenting as an event procedure.

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Open form by doubleclicking datasheet (2000)

    Hans' response is one way to solve the problem, though we very seldom use the datasheet view for forms because of the way keyboard navigation works, and because we generally restrict users to viewing one record at a time. One thought occurred to me relative to creating a form where it was continuous and looked something like a datasheet but was still in form view would be to lock and disable all the controls, and then overlay a transparent control that was the only enabled control, and use it's double click to open the edit form. In your case, Hans' solution may work just as well.
    Wendell

Posting Permissions

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