How will I use the function!



I would like to warn the user that the loan number they entered is already in
the database with a messagebox that will indicate which reasons were marked
for that when it was entered previously. The reasons are true/false so if a
reason is checked, its true.

Loan number 00000 has already been entered twice as follows
by: Jane 04/04/06 with reason Q1,Q2,Q4
Mary 05/01/06 with reason Q5,Q6

I have the following function to get the true responses.......
Function GetTrueResponses(ByVal lLoanID As Long) As String

Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim fld As DAO.Field
Dim sql As String
Dim strOut As String

Set dbs = Currentdb()
sql = "SELECT Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10 " & _
"FROM tblLoanTable WHERE LoanID = " & lLoanID
Set rst = dbs.OpenRecordset(sql,DbOpenSnapshot)

If Not rst.Bof and Not rst.Eof Then
For Each fld In rst.Fields
If fld = true then strOut = strOut & fld.Name & ", "
If Len(strOut) <> 0 Then strOut = Left(strOut, Len(strOut)-2))
GetTrueResponses = strOut

Set rst = Nothihg
Set dbs = Nothing

End Function


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