DblClick a record on a datasheet

AndreT

Registered User.
Local time
Today, 11:04
Joined
Mar 16, 2011
Messages
26
I want to be able to open an update form when I double click a record in a datasheet (personally I don't like the split form). Do I have to create a double click event for every field? Or is there a shortcut for this one event for all? I tried Form's Detail_Dblclick but it doesn't do anything.

Also how do I create a double click on the record selector? I tried Form_DblClick which works with record selector, but if I double click the column divider, it opens the update form instead of expanding the column.

Thanks for your advice in advance.
 
The following code in the Form's On Dbl Click event should do what you are after;
Code:
Private Sub Form_DblClick(Cancel As Integer)
    
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FormNameToOpen"
    
    stLinkCriteria = "[YourRecordID]=" & "'" & Me![YourRecordID] & "'"

    DoCmd.OpenForm stDocName, , , stLinkCriteria
 
    
End Sub
 
Hi, John -

Thanks for your quick response.

I tried Form_DblClick event and works but ..., if I double click the datasheet column heading, instead automatically expand the column to fit, instead it opened the update form. Any way to prevent that from happening?

Appreciate your help.
 
Strange :confused: I've just tested in my sand box DB and can't replicate that behaviour. If I double click the header it simply opens the form filtered to the record at the top of the datasheet. Also the code only works if the record selector is double clicked or the header (with the behaviour I described).
 
Sorry, missed one word: when "double click column header DIVIDER", it opened the update form as you prescribed, but not sizing the column heading to fit. I'd like to preserve the sizing option.
 
Just tested that in the Sand Box and that behaviour of double clicking the divider still persists. In fact where double clicking the header results in the first record on the Datasheet being opened, Double clicking the divider has the two fold result of opening the currently selected record in the pop up form and resizing the column.

What version of Access are you running. All my testing is in Access '03
 
Sorry, changing my table structures resulting in massive form and event changes.

I'm in Windows 7, Access 2007
 

Users who are viewing this thread

Back
Top Bottom