Subject: RE: Attachment going to the bottom of Document in Client.
Hi Martha,
I have 2 attachment fields in my form. They are:
Attachments_CP
Reference
I do not refer these fields and/or modify these fields on the code at the “Submit” button click. The issue happens in either of the 2 attachment fields.
Here it goes:
Sub Initialize
On Error Goto errhandler
’ const NotesMacro$ = “@IsMember(ReportName;RequiredReading)”
Dim lowks As New NotesUIWorkspace
Set ss = New NotesSession
Set db = ss.CurrentDatabase
Dim ReqNo As String
Dim ReviewType As String
Dim GivMsgToUser As String
GivMsgToUser = ""
Dim codRev As Integer
codRev = 0
Dim TestRev As Integer
TestRev = 0
Dim docColl As NotesDocumentCollection
Dim DefectDoc As NotesDocument
Dim BASDoc As NotesDocument
Dim BASColl As NotesDocumentCollection
Dim BASview As NotesView
Dim view As NotesView
Dim keydoc As NotesDocument
Dim FTRDate As NotesDateTime
Set BASview = db.GetView("AllbysubTowerBAS")
Set currUidoc = lowks.CurrentDocument
Set currdoc = currUidoc.Document
Set view = db.GetView("KeywordsLokup")
Set keydoc = view.GetDocumentByKey("BAS",True)
If keydoc Is Nothing Then
'Msgbox "keydoc not found"
Exit Sub
End If
If Not keydoc Is Nothing Then
Set todaysdate = New NotesDateTime("Today")
Set FTRDate = New NotesDateTime(keydoc.KeywordsTXT(0))
'If FTRDate.TimeDifference(todaysdate) <= 0 Then
If currdoc.HasItem("FTR_Required") Then
If currdoc.FTR_Required(0) = "1" Then
'Megha - 6 Nov 12 - BAS Changes - for Pilot Towers and Discrete ARMs
If ((currdoc.SubTower(0) = "RD Milwaukee (RMG)") Or (currdoc.Tower(0) = "FULFILLMENT" And currdoc.SubTower(0) = "TOPS") Or (currdoc.Tower(0) = "Customer Care" And currdoc.SubTower(0) = "Omega") Or (currdoc.Tower(0) = "APAC Local") And (currdoc.BASStatus(0) <> "BAS not required")) Then
If Cint(currdoc.Hours(0)) >= 28 And (currdoc.NextStep(0) = "2" Or currdoc.NextStep(0) = "3") Then
If currdoc.BASStatus(0) = "" Or currdoc.BASStatus(0) = "Draft" Then
Set BASColl = currdoc.Responses()
If Cint(BASColl.Count) > 0 Then
Set BASDoc = BASColl.GetFirstDocument()
If BASDoc.Form(0) = "frmBASDoc" Then
Msgbox "Please fill up the BAS document. It is already Saved in Draft Status. Go to the view --> By Tower and SubTower and BAS to access it.",MB_OK, "Data Validation"
BASDoc.Status = currdoc.Status(0)
continue = False
Call currdoc.Save(True,True)
Call BASview.Refresh()
Call currUidoc.Close(True)
continue = False
Exit Sub
Else
End If
Else
%REM
Set BASDoc = db.CreateDocument()
BASDoc.Form = "frmBASDoc"
BASDoc.RequestRefNo = currdoc.RequestRefNo(0)
BASDoc.BASStatus = "Draft"
Call BASDoc.MakeResponse(currdoc)
Call BASDoc.Save(True,True)
%END REM
Msgbox "Please fill up the BAS document. It is mandatory as a part of Audit. Click on Create BAS Document button",MB_OK, "Data Validation"
continue = False
Exit Sub
End If
End If
End If
End If
End If
End If
End If
'Ends - Megha - BAS Changes
Dim success As Variant
If GivMsgToUser = "" Then
'Checking for All Validations with ComputeWithForm
success = currdoc.ComputeWithForm(False,False)
If success Then
ReqNo = currdoc.RequestRefNo(0)
If currdoc.Codes(0) <> "" Then
If Len(currdoc.Codes(0)) <> 20 Then
Msgbox "Please text a 20 characters Accounting Code only. ",MB_OK, "Accounting Codes Validation"
Exit Sub
End If
End If
If currdoc.Points(0) <> "<Select a Choice>" And currdoc.Count(0) = 0 Then
Msgbox "Size Count is required. Please fill the same in Size Count field",MB_OK, "Size Count"
Exit Sub
End If
If currdoc.Hours(0) = "" Then
Msgbox "Estimate Hours is required. Please fill the same",MB_OK, "Hours Required"
Exit Sub
End If
Dim CUname As Integer
Dim CUname1 As Integer
CUname = Instr(ss.UserName,"Consultants")
CUname1 = Instr(ss.UserName,"CONSULTANTS")
If CUname > 0 Or CUname1 > 0 Then
If currdoc.ROM_Hours(0) = "" Then
Msgbox "ROM Estimation Hours is required. Please fill the same",MB_OK, "ROM Estimate Hours Required"
Exit Sub
End If
End If
If currdoc.Points(0) <> "<Select a Choice>" Then
If (currdoc.Check_CP(0) <> "Yes") Then
Msgbox {Complete Estimation sheet is required. Please attach the same in Attach CP field and Check "Yes" if the sheet is attached},MB_OK, "Attach CP"
Exit Sub
End If
End If
If currdoc.Hours(0) >= 360 Then
If currdoc.NextStep(0) = "3" & (currdoc.Check_SOW(0) = "No" & currdoc.Check_SOW(0) = "") Then
Msgbox {SOW is required. Please attach the same in Attach SOW field and select "Yes" in Please check if SOW is attached field.},MB_OK, "Attach SOW"
Exit Sub
End If
End If
Dim InfraSuccess As Variant
InfraSuccess = False
InfraSuccess = UpdateIPTforInfra(currdoc)
If InfraSuccess = True Then
Call lowks.DialogBox("dlgComments")
comm = currUidoc.FieldGetText("txtComments")
Dim MailsSuccess As Variant
MailsSuccess = False
MailsSuccess = SendMails(currdoc,currUidoc)
If MailsSuccess = True Then
'Commented as Governance Approval will be applicable after Approved for WO - Megha - 26 Jun 2013
'If currdoc.Hours(0) >= 360 Then
' currdoc.Status = "Pending with Governance"
' hist = Now() + ", " + ss.CommonUserName + "- " + "Pending with Governance" + " <" + currdoc.txtComments(0) + " >"
'Else
currdoc.Status = "ROM Estimate Completed"
hist = Now() + ", " + ss.CommonUserName + "- " + "ROM Estimate Completed" + " <" + currdoc.txtComments(0) + " >"
'End If
eval = Evaluate(|@Date(@Year(@now);@Month(@now);@Day(@now);@Hour(@now);@Minute(@now);@Second(@now))|)
'Commented as Governance Approval will be applicable after Approved for WO - Megha - 26 Jun 2013
' If currdoc.Hours(0) >= 360 Then
' currdoc.Pend_Gov_Date = Format(eval(0),"mm/dd/yyyy")
' SDate = currdoc.Pend_Gov_Date(0)
' Set ndtNow = New NotesDateTime(SDate)
' Call ndtNow.ConvertToZone(5, True)
' Set currdoc.Pend_Gov_Date = ndtNow
' Set currdoc.ROMComplete_Date = ndtNow
' Else
'If currdoc.NextStep(0) = "1" And currdoc.Hours(0) > 27 Then
' currdoc.NextStep = "3"
'End If
currdoc.ROMComplete_Date = Format(eval(0),"mm/dd/yyyy")
SDate = currdoc.ROMComplete_Date(0)
Set ndtNow = New NotesDateTime(SDate)
'currdoc.ROMComplete_Date = ndtNow.LSGMTTime
'Call ndtNow.ConvertToZone(5, True)
Call ndtNow.SetNow
Set currdoc.ROMComplete_Date = ndtNow
'End If
If currdoc.History(0) = "" Then
currdoc.History = hist
Else
currdoc.History = currdoc.History(0) + Chr(10) + hist
End If
currdoc.SaveOptions = 0 'This given to not to prompt user to Save.
Call currdoc.Save(True,True)
Call currUidoc.Close()
Else
Exit Sub
End If
Else
Exit Sub
End If
Else
Msgbox {"You must fill out all required fields before performing this action. To exit without saving, press [Esc] and select \"NO\" when prompted."},MB_OK, "Validations"
Exit Sub
End If
Else
'Prompt to the user
Msgbox GivMsgToUser,MB_OK, "No Peer Review Defects Found"
Call currdoc.Save(True,True)
Exit Sub
End If
Exit Sub
errhandler:
Msgbox "An error occurred in (Complete Estimate) agent of ARM database at line number " + Cstr(Erl()) + "And the error is " + Cstr(Error()) + Chr(10) + Chr(10) + "Please raise an incident with ADM_Lotus Notes Team. Thanks "
Exit Sub
End Sub
Please write to me if you find anything.
Thanks & Regards,
Megha.