Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    On DblClick event (2003)

    On a form, I have a text box that displays the concatenated view of an employee's address. The user cannot edit this box, of course. I want to use the On DblClick event to open another simple form where the separate fields for address can be edited. Oh...I also want the form to open with the current employee's record on display. I've done this before, and I did it with some help from this forum...I just can't find the post.

    Thanks!

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

    Re: On DblClick event (2003)

    The text box should have Enabled set to Yes, for if Enabled = No, the user can't click or double click it. In the following, I use the following assumptions:

    txtAddress = name of the text box.
    EmployeeID = a numeric field that is a unique identifier for the employee.
    frmDetails = form to be opened.
    EmployeeID must be in the record source of both the form that contains the text box and of the form to be opened.

    Here is the event code for the On Dbl Click event of the text box:

    Private Sub txtAddress_DblClick(Cancel As Integer)
    DoCmd.OpenForm FormName:="frmDetails", _
    WhereCondition:="EmployeeID = " & Me.EmployeeID, _
    WindowMode:=acDialog
    End Sub

    If EmployeeID is a text field, the WhereCondition becomes

    "EmployeeID = " & Chr(34) & Me.EmployeeID & Chr(34)

  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: On DblClick event (2003)

    An alternative is to put a transparent command button in front of the textbox, then put your code calling that other form in the command buttons Click or dblClick event. This allows you to set the textbox's Enabled property to No.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: On DblClick event (2003)

    Hello, Hans! I hadn't thought about how Enabled = No would affect this operation. Thanks for the tip!

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Virginia, USA
    Posts
    1,560
    Thanks
    37
    Thanked 1 Time in 1 Post

    Re: On DblClick event (2003)

    Now, that's very interesting! I'll have to try that. Thanks!

Posting Permissions

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