Get Key Value from a row

  • Thread starter Thread starter shoe
  • Start date Start date
S

shoe

hello!

I have struggled with this all afternoon and need help!
I have 3 functions that Read/write to an Access database.
The Database has autonumber for primary Key.

Tablenamne: tblKontroll
Fields: ID,passWord,UserName

This sql line works and search the table for "User" and "Pass"
"SELECT [UserName],PassWord FROM tblKontroll WHERE UserName= '" & User
& "' AND PassWord = '" & Pass & "'"

This sql line works also and insert a recored into Access Database
"INSERT INTO tblKontroll ([UserName],[PassWord]) VALUES('" & User &
"','" & Pass & "')"


THIS LINE DOES NOT WORK
(it's suppose to return the ID Field Number from the row having the
"User" and "Pass" in it)

"SELECT ID FROM tblKontroll WHERE UserName= '" & User & "' AND
PassWord = '" & Pass & "'"

what is wrong, I search for information about this and think this
should work???
 
I guess ID may be a reserved word, so Select [ID] may do the thing,
or change the name in the database to User_ID, etc.
 
Back
Top