Hi,
I've done this some years ago in a previous job, but don't have that code now. I would like to make a change to an existing query and have it saved so that if I were to click on the design view of the query, it would look as if the criteria were already there when done in design view. When I run the code, I receive the error 3012 Object already exists, which is true. How can I modify the code in [red]red[/red] to allow it to save the existing query with the changes?
I've done this some years ago in a previous job, but don't have that code now. I would like to make a change to an existing query and have it saved so that if I were to click on the design view of the query, it would look as if the criteria were already there when done in design view. When I run the code, I receive the error 3012 Object already exists, which is true. How can I modify the code in [red]red[/red] to allow it to save the existing query with the changes?
Code:
Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim strSQL As String
Set db = CurrentDb
...
...
[red]
Set qd = db.CreateQueryDef("qryGraduate", Replace(CurrentDb.QueryDefs("qryGraduate").SQL, "='On';", "='Exclude On';"))
[/red]
...
...