Make your own free website on

Page 17



  If Len(sDigits) = 10 Then


    Me.Print "Receiving :" & sDigits

    ' 10 digits number need to be checkd against Number in the DB


   'SELECT Name from numberInfo where Number = "sDigits"

   ' Fuunction

   iName = GetNextRecord(sDigits)

   MSComm1.Output = sDigits + iName + Chr(13)


   Me.Print "Sending :" & sDigits

   sDigits = ""      ' Clear the string for next code

   End If

 End If


End Sub


Public Function GetNextRecord(ByVal criteria As String) As String

'Open the recordset and select the next record

OpenDB (App.Path & "\Pass-Number.mdb")

'Private declarations for the database and recordset

Private db As Database

Private RS As Recordset

Dim iName As String

Set RS = db.OpenRecordset("SELECT Number, Name FROM numberInfo _

"WHERE Number = "'" & criteria "'")

Number = sDigits

If RS.bof Or re.EOF Then

   iName = RS.fields(1)


   iName = "Try Again"

End If


    'Return the field value

    iName = "" & RS.fields(Name).Value


    'Close the recordset


GetNextRecord = iName

End Function


Public Sub OpenDB(dbName As String)

'Open the database

Set db = OpenDatabase(dbName)

End Sub



Home ] Up ]

Send mail to with questions or comments about this web site.
Last modified: July 13, 2002