Help with lost focus event

G

Guest

Hi,

I need help with lost focus event. I have a table(tbl_appr) with social,
appseq, audit type as primary key. One social can have many appseq numbers. I
want to have a lost focus event on social so that when a social is entered a
message box should appear with all appseq numbers associated to the social.

Suppose for example I have 000-00-0000(social), 99(appseq), Processor(audit
type)
000-00-0000, 98, Processor
000-00-0000, 97, processor

Now when I enter social in the field I should get a meesage "000-00-0000 has
been processed with different appseq numbers 99,98,97. Do you wish to
continue?" Yes/No

Can anyone let me know how can I modify the below code based on the above
example.

Private Sub SSN_LostFocus()

If Not IsNull(SSN.value) Then
If appraisal_app_seq(Me.SSN.value, Me.AppSeq.value, Me.scorecard.value)
Then
If scorecard = "Processor" Then
answer = MsgBox "the above message in the example should go
here",vbyesno , version
End If
If answer = vbno then
exit sub
end if

End If
End If

End Sub

Below code is in Module

Public Function appraisal_app_seq(SSN As String, AppSeq As String, scorecard
As String) As Boolean
Dim dbslog As Database, rstlog As Recordset
Dim sSql As String
sSql = "SELECT * FROM tbl_appraisalreview WHERE SSN ='" & SSN & "' and
AppSeq ='" & AppSeq & "' and audit_type = '" & scorecard & "'"

Set dbslog = DBEngine.Workspaces(0).Databases(0)
Set rstlog = dbslog.OpenRecordset(sSql, dbOpenSnapshot)
If rstlog.RecordCount >= 1 Then
appraisal_app_seq = True
Else
appraisal_app_seq = False
End If
rstlog.Close
End Function

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top