I have this code and even though I am saving and closing the uidoc, I am still getting the pop up message asking “Do you want to save your changes?” (with Yes/No/Cancel options). Any ideas? Thanks much!
'Save & Exit button
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim workspace As NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim con As ODBCConnection
Dim qry As ODBCQuery
Dim res As ODBCResultSet
Dim doc As NotesDocument
Dim id As String, psuid As String, prefname As String, acctname As String
Dim mnum As String, expdate As String
Dim desiredresult As Variant
Set workspace = New NotesUIWorkspace
Set uidoc=workspace.currentdocument
Set db = session.CurrentDatabase
’ warehouse control
Dim wh_db As New NotesDatabase("","")
Dim wh_doc As NotesDocument
Dim wh_view As notesview
Set wh_db=session.getdatabase("DDAS2/Notes","acswrhsct.nsf")
Set wh_view=wh_db.getview("CT2")
Dim c1 As String, c2 As String, c3 As String, c4 As String
Set wh_doc = wh_view.Getfirstdocument
If Not wh_Doc Is Nothing Then
c1 = wh_doc.ColumnValues(0)
c2 = wh_doc.ColumnValues(1)
c3 = wh_doc.ColumnValues(2)
c4 = wh_doc.ColumnValues(3)
End If
Set con = New ODBCConnection
Set qry = New ODBCQuery
Set res = New ODBCResultSet
Call con.connectTo(c1,c2,c3)
If con.GetError <> DBstsSUCCESS Then
Messagebox con.GetExtendedErrorMessage,, _
con.GetError & " " & con.GetErrorMessage
Goto Exit_Sub
End If
Set qry.Connection = con
Set doc=uidoc.document
Mnum = doc.Mnum(0)
If Mnum="" Then
Messagebox "Please enter a valid membership number."
Goto Exit_Sub
End If
Call uidoc.Refresh
’ Dim dtToday As String
’ dtToday = Today ( )
Dim dtToday As Variant
DtToday = Today
Dim dateV As String
dateV = doc.GetItemValue("ExpDate")(0)
’ If uidoc.IsNewDoc Then
If (Cdat(dateV)) >= dtToday Then
’ If dateV >= dtToday Then
'Membership Number
’ qry.SQL = "select * from psu_mv_den_bio where memb_number = " + “” + Mnum + “” + " and memb_status_code = ‘A’ and primary_ind = ‘Y’ "
qry.SQL = "select * from psu_mv_den_bio where memb_number = " + "" + Mnum + "" + " and memb_status_code = 'A' "
If qry.GetError <> DBstsSUCCESS Then
Messagebox qry.GetExtendedErrorMessage,, _
qry.GetError & " " & qry.GetErrorMessage
Goto Exit_Sub
End If
Set res.Query = qry
res.Execute
If res.IsResultSetAvailable Then
doc.memb_status_code = res.GetValue(182)
Call uidoc.Save
Call uidoc.Close
Call workspace.ComposeDocument( "", "", "EFTDeduct" )
Else
Messagebox "There was no active membership information found for this membership number, please try again"
End If
doc.expDateforExtract = Format(doc.expdate(0),"YYYYMMDD")
Else
Call uidoc.Save
Call uidoc.Close
Call workspace.ComposeDocument( "", "", "EFTDeduct" )
End If
Exit_Sub:
res.Close(DB_CLOSE)
con.Disconnect
End Sub