In MS Access 2013, I have a make table query with a myField criteria of "01".
In VBA, I have an array of values that I loop through and want to replace value "01", with the value of 'x'.
When I hover over the 'x' value in debug mode, I see the correct value, however in the immediate window (debug.print) it still reflects as "01".
Why is this not working? and/or what else could I use to make this work?
I am using the .SQL Replace code below.
Code:
Set qdf = CurrentDb.QueryDefs("i_qry_446_1")
With qdf
qdfOLD = .SQL
Debug.Print .SQL
.SQL = Replace(.SQL, "(PID.CNTY_CD)='01'", "(PID.CNTY_CD)=" & "'" & x & "'")
Debug.Print .SQL
'create the table
DoCmd.SetWarnings False
DoCmd.OpenQuery "i_qry_446_1"
DoCmd.Close
DoCmd.SetWarnings True
DoCmd.OpenQuery "i_qry_446"
DoCmd.Close
'export report 446
.SQL = qdfOLD ' Reset SQL to old setting
End With '446
Thank you for any help.