ms access - Unbound textbox compared to value in table, Datatype mismatch? -


i working on project class building database in ms access , using bit of sql , vb first time. attempting include login feature project.

my form uses code on button labelled "login" take in input user in unbound textboxes, named txtemployeeid , txtpassword, , compare them values in table employee_t, named employeeid , employeepw. employeeid integer value while employeepw string.

    private sub command1_click()     if isnull(me.txtemployeeid)         msgbox "please enter employeeid", vbinformation, "employeeid required"         me.txtemployeeid.setfocus     elseif isnull(me.txtpassword)         msgbox "please enter password", vbinformation, "password required"         me.txtpassword.setfocus     else          if (isnull(dlookup("employeeid", "employee_t", "employeeid = ' & me.txtemployeeid.value & ' "))) or _         (isnull(dlookup("employeepw", "employee_t", "employeepw = ' & me.txtpassword.value & ' ")))             msgbox "incorrect loginid or password"         else         end if     end if      end sub 

however, after pressing login button met error: run-time error '3464': datatype mismatch in criteria expression. point me in right direction? feel though error in way referencing variables.

i have never looked @ visual basic before project , not have book/teacher/classmate refer visual basic not learning.

thank in advance insight, , apologies formatting errors. first post.

it looks you're concatenating vaues in dlookup incorrectly.

'" & password & "' strings

" & employeeid & " integers

when compiled, these going :

string - '" & variable & "' -> compiled -> 'yourvariablevalue' integer - " & employeeid & " -> compiled -> 15 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -