I need to find the values for two columns in my table. The first one is a number and I able to find that one alone. I added the second column and it does not seem to work. It is a check box and all I need the function to return is the value of the text box. The values need to be on the same row because the checkbox corresponds to the specified value. This is written into access and the database is also located within the program. Thank you for your help.

Public Function CheckLetter(InString) As String
Dim x, CurrentPath, OCN1, OCN2 As String

Dim db As DAO.Database
Dim rs As DAO.Recordset


Set db = CurrentDb()
x = CurrentProject.Path
Column = "Column1" 'This is the number that the function 'already finds
Column2 = "Column2" ' This is the check box column
Set rs = db.OpenRecordset("MainTable")
rs.MoveFirst
Do While Not rs.EOF

rs.Edit
' OCN2 = "True"
If Not IsNull(rs(Column)) Then
OCN1 = rs(Column)
OCN2 = rs(Column2)
End If
If OCN1 = InString Then
MsgBox (OCN2)
' CheckLetter = True

' OCN2 = rs(Column2)
Else
' OCN2 = "False"
' CheckLetter = False

End If
' MsgBox (Check)


rs.MoveNext
Loop
rs.Close


End Function

hey can u explain this code??

Dim choice as integer
Dim Points(0 To 8) As Integer
choice = lstg1.ListIndex '
lblp1.Caption = Points(choice)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.