Loyd Chis 27.Oct.06 03:36 PM a Web browser Domino Designer 6.5.5 Windows XP
I have this code that lets the user pick a year and a location then displays the info. The code just pulled in the data from one view and displayed the embedded view with the data.
I need to change this up a little but not sure how. Instead of showing the embedded view, I have rich text fields that I need to populate, basically making a list on the new form, but one document.
Sub Click(Source As Button)
'dim and set the objects
Dim session As New notessession
Dim dbCurr As notesdatabase
Set dbCurr = session.currentdatabase
Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Dim docCurr As NotesDocument
Dim pickDoc As notesdocument
Set uidoc = ws.currentdocument
Dim newuidoc As notesuidocument
Set docCurr = uidoc.document
Dim getdoctitle As Variant, doctitle As String
Dim yearnums(3) As Variant
Dim i As Integer
Dim pickview As notesview
Set pickview = dbCurr.getview("ShowLocation")
'what year do they want, present list of one year before current year, current year, and one year after
'or alternatively give them a picklist of year view
YearNow = Year(Today)
yearnums(0) = YearNow + (-1)
yearnums(1) = YearNow
yearnums(2) = YearNow + 1
For i = 0 To 2
yearvals(i) = Cstr(yearnums(i)) 'convert the years to a string so that we can present it
'give them the view to choose a document from
server = dbCurr.server
dbname = dbCurr.FileName
viewname = "showlocation"
'give them a list of documents for selection
picklist = ws.Pickliststrings(3,1,server,dbname,viewname, "OSHA Form 300","Select a Location.",3,"")
If Isempty(picklist) Then Exit Sub 'they have pressed cancel
location = picklist(0)
whichyear = ws.Prompt( PROMPT_OKCANCELLIST, "OSHA Form 300", "What year do you want to view?", yearvals(1), yearvals)
If whichyear = "" Then
'they have pressed cancel
'create the document and open it
Dim OSHA300form As NotesDocument
Set OSHA300form = dbCurr.CreateDocument
OSHA300form.Form = "OSHA300form"
OSHA300form.selection = temp1 & "~" & whichyear
OSHA300form.formloc = temp1
OSHA300form.formyr = whichyear
OSHA300form.formstate = temp2
Set NewUIDoc = ws.EditDocument(True, OSHA300form, False)
I do still need to capture the year and location then display the data based on those fields. Below are fields ( a,b,c,d,e,f) that I have on the form where the data will be displayed. I'm just not sure if I'm collecting them correctly. It should loop through the docs and display the fields on the new document.
I'm just really confused will all the ways to colllect the data. The more I look at this, the more I get confused????
Can someone kinda narrow this code down so it makes sense to me. Thanks.
If collection.Count > 0 Then
Set doc2 = db.CreateDocument
doc2.form = "OSHA300Form"
doc2.formloc = location