I'm new to access and VBA but I've managed to get some functions up and running for the most part. I need a bit of help/advice as to how to create a confirm insert after the button is clicked.
Any advice is greatly appreciated.
Code:
Private Sub cmdAddCitation_Click()
Dim rsCT As Recordset
Dim db As Database
Dim newCID As Long
Dim tmpCID As Long
If Not IsNull(Me.cboTitle) And Not IsNull(Me.cboType) Then
tmpCID = CIDFound 'Checks if citation entered is existing or not
If tmpCID <> -999 Then
AddCIDtoDS tmpCID, Me.Parent.DissertationID 'Citation is existing so it will be added to the currently selected Dissertation
Me.Requery 'Join table (tblDisserationToCitationJoin) will be populated by CitationID and DIssertationID
Else
Set db = CurrentDb 'Citation is not yet existing so it will be added to the Citations table and subsequently tblDisserationToCitationJoin will be populated
Set rsCT = db.OpenRecordset("tblCitations")
rsCT.AddNew
rsCT!CitationTitle = Me.cboTitle
rsCT!CitationYear = Me.cboYear
rsCT!CitationAuthorLastName = Me.cboLastname
rsCT!CitationType = Me.cboType
newCID = rsCT!CitationID
rsCT.Update
AddCIDtoDS newCID, Me.Parent.DissertationID
Set db = Nothing
rsCT.Close
Me.Requery
End If
Else
MsgBox "Please enter Citation Title and Year.", vbInformation, "No Citation Title or Year."
End If
End Sub
Any advice is greatly appreciated.