Small OfficePool From a Button


  1. Create a mail-in db ,
  2. Assign email address to it,  
  3. Create an new view , categorizes  the Subject  ,
  4.  create button
  5. Add this code to the LS section of the button

Change EMAIL to the one you are using . your done . simple  huhh ?  

its just a demo and HR would never ask thease kind of  questions.  

Sub Click(Source As Button)
 
 Dim ws As New NotesUIWorkspace
 Dim session As New NotesSession
 Dim prompt As String
 Dim db As NotesDatabase
 Dim doc As NotesDocument
 Dim Quat As String
 Dim Spurning1 ,Spurning2 ,Spurning3 ,Spurning4 As String
 
 
 ‘———————————————————————————————-
 Quat = “4” ‘ Questions –  change this to total Questions
 ‘———————————————————————————————-
 ‘Questions are :  they are only Yes and no questions
  Spurning1 = “Are you female?”
 Spurning2 = “Are you over 30 years old? ”
Spurning3 = “Are you below 50 years old ? ” 

Spurning4 = “Do you like anyone that works with you ?”
   ‘————————————————————————————————–
  
 ‘ Spurning no 1
 prompt = “Questions from HR ! ”
 Maki = ws.Prompt(1, “Questions from HR “, prompt, “”)
‘__________________________________________________________________________________
 
 ‘ Don´t change anything here below
‘__________________________________________________________________________________ 
 
 Q1 = ws.Prompt(2, Spurning1, Spurning1, “”)
 If Q1 = 0 Then
  Messagebox(“thanks  – your answer is received”)
  Goto done
 End If
 
 If Quat  > 1 Then
  Q2 = ws.Prompt(2, Spurning2, Spurning2, “”)
 Else
  Goto done
 End If
 If Quat  > 2 Then
  Q3 = ws.Prompt(2, Spurning3, Spurning3, “”)
  If Q3 = 1 Then
   Goto OK
  End If
 Else
  Goto done
 End If
 If Quat  > 3 Then
  Q4 = ws.Prompt(2, Spurning4, Spurning4, “”)
 Else
  Goto done
 End If
OK:
 Messagebox(“Thanks – your answer is received “)
done:
 If Q1 = 1 Then
  Q1 = “Yes”
 Else
  Q1 = “No”
 End If
 If Q2 = 1 Then
  Q2 = “Yes”
 Else
  Q2 = “No”
 End If
 If Q3 = 1 Then
  Q3 = “Yes”
 Else
  Q3 = “No”
 End If
 If Q4= 1 Then
  Q4 = “yes”
 Else
  Q4 = “No”
 End If
 
 Dim maildoc As notesdocument
 Set db =  session.CurrentDatabase
 Set mailDoc = New NotesDocument( db )
 mailDoc.Form = “Memo”
 mailDoc.Subject = “Poll from -” & Spurning1  & ” frá ” & session.CommonUserName
 mailDoc.Body = Spurning1 & ”  =  ” &Q1    & Chr(13)   &   Spurning2 & ”  =  ” &Q2   & Chr(13)   &   Spurning3 & ”  =  ” & Q3 &  Chr(13)   &   Spurning4 & ”  =  ” & Q4
 maildoc.SendTo = “EMAIL” 
 Call mailDoc.Send(False)
End Sub

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s