So I am currently working a project and I and I need to create verify text given through an input box against an SQL result.

If the number "15" is entered and the sql table contains 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 I need it to save the number variable if a match is found and if not I need it to loop and ask for another number. Seems easy but I'm overthinking it.

number = InputBox("Enter Number")

Set sqlResult = (SQL query for temp information)

If Number = sqlResult.Fields(0) Then
Number = sqlResult.Fields(0)
Number = 0
End If
Loop Until sqlResult.EOF

Help appreciated!