Doc.NameField = "adam" will work but
doc.$KeepPrivate = "0" will not even compile/save.
NB $KeepPrivate prevents a document from being copied or printed.
Try using doc.~$KeepPrivate = "0" instead.
Here is the code for an action button "Allow Copy" I have in my administration views.
Dim s As New notessession
Dim db As notesdatabase
Set db = s.currentdatabase
Dim col As notesdocumentcollection
Dim doc As notesdocument
Set col = db.unprocesseddocuments
Set doc = col.getfirstdocument()
Do Until doc Is Nothing
doc.~$KeepPrivate = "0"
Call doc.save(False,False)
Set doc = col.getnextdocument(doc)
Loop
This of course works with $ref. You use doc.~$ref(0) etc.
You can put a tilde anywhere in a field name in lotusscript and it is ignored apparently, discovered by Doug Tait after a typo.