Hi,

I have a weely report which contain of 2 text box. EmpNo.txt and Position.txt. I need to get the data from my access database when the form is loaded.

Before go to the weekly report form the system will check the loginID and password. The empno and position data is in the same table in Access. So, how I can write a code to tell system if the loginID and password is same as usertable then provide the Empno and position?

Please help!

Hi,

I have write a code for the problem I'm facing, but it have some error,please help.

Private Sub Form_Load()

Dim Mydb As ADODB.Connection
 
Set Mydb = New ADODB.Connection
 
GetDB Mydb
 
Dim RS As ADODB.Recordset
Set RS = New ADODB.Recordset

Dim strName As String

strName = frmLogin.txtUserName.Text


RS.Open "Select EmpID from UserTable WHERE UserName =" & "'" & strName & "'", Mydb, adOpenKeyset

txtEmpNo.Text = RS!EmpID



 
  RS.Close
  Mydb.Close

Did you manage to solve your problem yourself, or does this still need to be solved?

I solve the problem by myself oledi...thanks!

Well done! It's a pleasure.:)

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.