Reset Answer Field in Test Database

M

MNID13

I created a Q&A Test database (100 questions)...I would like to reset the
answer field (StAnsr) and leave the remaining fields undisturbed. Below is
the code that I am using:

Dim REC As Recordset
Dim RemString, workingdata As String
Dim DBS As Database
Dim Zero As String

Set DBS = CurrentDb()
Zero = " "
RemString = "Select [TstTkr2007tbl].[StAnsr] From [TstTkr2007tbl] WHERE
([TstTkr2007tbl].[StAnsr] = " * ") "

Set REC = DBS.OpenRecordset(RemString)
RemString = Zero

While (Not (REC.EOF))
REC.MoveNext

Wend
REC.Close
DBS.Close

Any help figuring this out would be helpful...this thing is giving me fits...
 
D

Douglas J. Steele

No need for a recordset: use an Update query. It's almost always
significantly faster to use SQL than VBA.

Dim strSQL As String
Dim DBS As Database

Set DBS = CurrentDb()
strSQL = "UPDATE [TstTkr2007tbl] " & _
"SET [StAnsr] = Null " & _
" WHERE [StAnsr] IS NOT NULL"
DBS.Execute strSQL, dbFailOnError
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top