Please Help me with my project. I'm currently first year in college and one of our projects is to make a system that will have database.

What I want to do is when I login to the Interface the value of the username will be diplayed throughout the whole program. I'm currently using vb6 and so far I'm trying this code.
I'm new to this and so I can't find it on my own.

Here's the code so far;

Private Sub Command1_Click()

    If Adodc2.RecordSource = "Select * from Cashier where username='" + AbLogin.Text1.Text + "'" Then

        Adodc2.RecordSource = "Select * from Cashier where fname='" + Text1.Text + "'"

    End If

and I try this one;

Set con = OpenDatabase("C:\Users\63927\Desktop\Project Cashier\\DatabaseFinale.mdb")
Set rr = con.OpenRecordset("select * from Cashier")

If AbLogin.Text1.Text = rr.Fields("username").Value & rr.Fields("username").Value = Text1.Text Then

     Adodc2.Recordset.Fields("fname") = Text1.Text

End If

VB6 is dead, try and upgrade tro a newer IDE, visual studio 2019 has a free version that you can start using.

That being said, do a global variable and use iot throughout your application -

Public txtUername as Text
txtUsername = AbLogin.Text1.Text