|I am doing a"pro bono" project for my church to manage a new area of the churchyard (place where cremated remains can be buried) I am not a VBA programmer but an "able amateur". So far we are able to double click on any cell (any one of 150) in an excel worksheet and run a macro to open the access database and open a form. I want to be able to filter the form with the content of the cell that was double clicked. The code I have found on the internet will do what I require except it will only filter with a specified cell address (A2). How can I remove A2 and replace it with the address of the cell that was double clicked or use a new line of code that will use the content of the double clicked cell as a filter|
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim LPath As String
Dim strLocation As String
'Path to Access database
LPath = "C:\Documents and Settings\Stuart\My Documents\Database1.accdb"
'Open Access and make visible
Set oApp = CreateObject("Access.Application")
oApp.Visible = True
'Open Access database as defined by LPath variable
'Open form called Input filtering by Location
strLocation = Range("A2").Value
oApp.DoCmd.OpenForm "Input", , , "Location = '" & strLocation & "'"
Many thanks for your attention