I'm very new to visual basic 6.0 and I have a very less knowledge in it.
My project is about airport boarding pass generator.
In my first form,I have a text box for entering PNR by the user. Here, the program has to search for the PNR already stored in a ADODB connected MS access database. IF the PNR entered by the user is right, then it has to go to the next form showing entire details of the passenger and flight, otherwise it should pop up a msg. box saying "invalid PNR".
here is the coding i used:

Dim conn As ADODB.Connection
Dim RS As New ADODB.Recordset

Private Sub Form_Load()
    Set conn = New ADODB.Connection
    conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\16hu3a120(part2)\BOARDING PASS3.mdb;Persist Security Info=False"
    conn.Open
    conn.CursorLocation = adUseClient
    RS.Open "select * from PID", conn, adOpenDynamic, adLockOptimistic
End Sub
Private Sub cmdcancel_Click(Index As Integer)
    MsgBox "DO YOU WANT TO CANCEL THE PROCESS?", vbYesNoCancel
    End
End Sub
Private Sub cmdconfirm_Click(Index As Integer)
    Dim pnr As String
    pnr = txtinput.Text
    Do
        If (pnr = RS.Fields(0)) Then
            MsgBox "SUCCESSFUL"
            Form1.Show()
        ElseIf (pnr <> RS.Fields(0) & RS.EOF = True) Then
            MsgBox "Invalid PNR", vbRetryCancel
            RS.MoveFirst
            End
            Exit Do
        End If
        RS.MoveNext
    Loop While RS.EOF = False
    If pnr = "" Then
        MsgBox " FIELDS CANNOT BE LEFT EMPTY", vbAbortRetryIgnore
    End If
    End
    Exit Sub
End Sub

thanks in advance :)

Recommended Answers

All 2 Replies

I have a question. I found the database connections to fail in 64 bit versions of current issues of Windows. As such we had to remove all database references and EOL (End Of Life) all the old VB6 apps that did database work. You may be new to VB6 but for intent and purposes it's a dead system.

Fun while it lasted.

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.