String and Inputbox

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

String and Inputbox

Post by burrina »

Code: Select all

strpassword = inputbox("Please enter registration password", "Password Required") 

If strpassword = (DLookup("ExpPswd", "tblExpired", "ExpPswd='" & strpassword & "'")) Then 
I'm not sure this is correct!

User avatar
HansV
Administrator
Posts: 78471
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: String and Inputbox

Post by HansV »

That should work. Other ways of doing it (just the second line) are:

Code: Select all

If Not IsNull(DLookup("ExpPswd", "tblExpired", "ExpPswd='" & strpassword & "'")) Then
and

Code: Select all

If DCount("*", "tblExpired", "ExpPswd='" & strpassword & "'") > 0 Then
Best wishes,
Hans

User avatar
burrina
4StarLounger
Posts: 550
Joined: 30 Jul 2014, 23:58

Re: String and Inputbox

Post by burrina »

Many Thanks.