Good Day All,
This is my existing query created manually and stored in the query pane:
I want this query to change to this, using VBA code, when I press a button:
This is the VBA code which I tried:
But Unfortunately, there is no change.
Can anyone show me the code to effect the change that I am expecting
This is my existing query created manually and stored in the query pane:
Code:
SELECT Names.Fname, Names.Lname
FROM [Names];
I want this query to change to this, using VBA code, when I press a button:
Code:
SELECT Names.Fname, Names.Lname
FROM [Names]
WHERE (((Names.Fname)="Manilla"));
This is the VBA code which I tried:
Code:
Private Sub TestQry_Click()
Dim curDatabase As DAO.Database
Dim rst As DAO.Recordset
Dim strFilter As String
Set curDatabase = CurrentDb
strFilter = "SELECT Fname, Lname From [Names] WHERE Fname =" & "'" & "Manilla" & "'" & " ;"
Debug.Print strFilter
Set rst = curDatabase.OpenRecordset(strFilter)
Set rst = Nothing
End Sub
But Unfortunately, there is no change.
Can anyone show me the code to effect the change that I am expecting