get all information from a username
hi, I am stuck at the point where it will just return whatever information is inside the excel database instead of the ones that relate to the username only.
Excel database
tblLogin
PK_LoginID-autonum (primkey)
Username-text
Password-text
tblTasks
PK_TasksID-autonum
FK_TasksID-num
Date-text
Tasks-text
for my vb application, I set the main form to hide itself and display the login form, once the user log on with the correct username and password, I only need the main form to display information about the username that logged on.
this is my sql statement I used
rstLogin.Open "SELECT * FROM tblLogin, tblTasks, tblMemo WHERE tblLogin.PK_LoginID = tblTasks.FK_TasksID;"...
any idea on how I can solve this problem? thanks for your time.
Re: get all information from a username
Once the user has logged in successfully store their ID then run your SQL query.
VB Code:
"SELECT * FROM tblLogin, tblTasks, tblMemo WHERE USERID = '" & ID & "'"
Re: get all information from a username
Your recordset should be like this :
rstLogin.Open "SELECT tblLogin.*, tblMemo.*, tblTasks.*
FROM (tblLogin INNER JOIN tblMemo ON tblLogin.PK_LoginID = tblMemo.FK_TasksID) INNER JOIN tblTasks ON tblLogin.PK_LoginID = tblTasks.FK_TasksID WHERE tblLogin.Username= '" & YourUsernameTextBox.Text & "'"
You wanted to link FK_TasksID with tblMemo, right?
Hope this help!