Paul Sansom
Board Regular
- Joined
- Jan 28, 2013
- Messages
- 178
- Office Version
- 2021
- 2016
- Platform
- Windows
I have an ADO connection to and table and i cannot see what is wrong with the reference to a sheet cell
If i change br for a simple text e.g. 'h' the filter works correctly.
What is the correct syntax for a refence to a cell on a sheet (Output). FYI Output is not the sheet where the results are shown
Many Thanks Paul
If i change br for a simple text e.g. 'h' the filter works correctly.
What is the correct syntax for a refence to a cell on a sheet (Output). FYI Output is not the sheet where the results are shown
Many Thanks Paul
VBA Code:
Private Sub byBranchRef()
' Filter by branch ref
Dim myADO As New clsADO
myADO.Connect ThisWorkbook.FullName
Dim br As String
br = Output.Range("d5")
myADO.RunQuery "Select Photonumber,BranchRef,Comments From [Photos$]" _
& " Where BranchRef = br ", shResults
End Sub