Search code examples
ms-accessvbams-access-2007crosstab

MS Access Double click event on query


MS Access 2007, Win 7 32-bits

Is there a way where I can access an open query in datasheet view in access to get the current field value and current field name?

I won't put it into a form since it is a crosstab query and i'd have to generate and get rid of controls dynamically but i'm not fond of messing with forms controls that way with VBA. I know i can put a dynamic column report and bind an event on the controls but I'm asking if there are events or objects that can let me access directly the query.

Perhaps a recordset clone? But I haven't find anything on google.

Of course this is in VBA

Best regards,


Solution

  • It may be possible to work around your requirements. The crosstab is contained by a subform:

    Source Object : Query.xtab
    

    crosstab

    The Control Source for the two textboxes is:

    Ctrl   : =[screen].[activecontrol].[name]
    Content: =[screen].[activecontrol]
    

    Which means they show which ever column ans column contents the user selects in the crosstab subform. However, they will also show any other selected control on the form. ClickMe does not change the selected control, so the selected items remain the same in the textboxes.