I have to change zeros to nulls in a table. I think the SQL statement does not like the way I pass the field names to it. When I run the procedure, I get prompted for strTblField. Any suggestions would be appreciated.
Public Sub RemoveZeros()
Dim strSQL As String
Dim strTblField As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Dim tdfNew As DAO.TableDef
‘reference current db and the table to be cleaned up
Set dbs = CurrentDb
Set tdfNew = dbs.TableDefs(“tblMEFinalResults”)
‘Clean up the zeros from fields of the tblMEFinalResults
For Each fld In tdfNew.Fields
strTblField = “tblMEFinalResults.” & fld.Name
‘sql clean up sql statement
”””””””””””””’ I think the problem is here…
strSQL = “UPDATE tblMEFinalResults SET strTblField = Null WHERE strTblField = 0″
”””””””””””””
DoCmd.RunSQL strSQL
Next fld
End Sub
Thanks,