This agent's code may help you do the above, but after you examine code at the bottom - here are few advices:
If you just want the view for one form don't use
Forall x In db.Forms
loop, but get only your form using db's method GetForm, like this:
Set frm = db.GetForm( "YourFormName" )
and then part of code that begins with:
Forall f In frm.Fields
Original code that does what is stated in the subject:
Sub Initialize
Dim s As New NotesSession
Dim w As New NotesUIWorkspace
Dim db As NotesDatabase
Dim frm As NotesForm
Dim vw As NotesView
Dim frmName As String
Dim c As NotesViewColumn
Redim frmNames(0) As String
Set db=s.CurrentDatabase
i=0
frmNames(i)=""
Forall x In db.Forms
i=i+1
Redim Preserve frmNames(i) As String
frmNames(i)=x.name
End Forall
frmName=""
frmName=w.Prompt(PROMPT_OKCANCELLIST, "Select a Database", "Select a database
to open.", "",frmNames)
Set vw=db.CreateView(frmName,{SELECT FORM = "}+frmName+{"})
'———————————————–
' Elimination of automatically created columns
'———————————————–
i=0
Forall columna In vw.Columns
i=i+1
End Forall
For j=1 To i
vw.RemoveColumn
Next
Set frm=db.GetForm(frmName)
Forall f In frm.Fields
If frm.GetFieldType(f)<>1 Then
Set c=vw.CreateColumn(,f,f)
Print frm.GetFieldType(f)
Select Case frm.GetFieldType(f)
Case AUTHORS,NAMES,READERS,1281<br/>
a$={@name([Abbreviate];}+c.Formula+{)}<br/>
c.Formula=a$<br/>
Case DATETIMES,1024<br/>
c.TimeDateFmt=0 <br/>
c.DateFmt=6<br/>
Case NUMBERS,768<br/>
c.NumberAttrib=2<br/>
End Select
'———————————————————————-
' Special cases of columns of type names non-detected by GetFieldType
'———————————————————————-
If Left$ ( f , 2 )="us" Then
a$={@name([Abbreviate];}+c.Formula+{)}<br/>
c.Formula=a$<br/>
End If
c.FontFace="Arial"
c.HeaderFontFace="Arial"
c.FontPointSize=9
c.HeaderFontPointSize=9
c.FontStyle=0
c.HeaderFontStyle=0
End If
End Forall
End Sub