Type Mismatch Access 2007

gregorg

Registered User.
Local time
Today, 06:08
Joined
Jul 26, 2006
Messages
56
Can any one tell me why I get a type mismatch here ?

private sub text78_keydown(keycode as integer, shift as integer)
dim k as string
if keycode = vbkeyreturn then
k = me.text78.text
docmd.openform "address query", acnormal,,,"[surname] = " & k,acformreadonly, acwindownormal
end if
end sub

Run Time Error 13 : Type Mismatch on docmd line ? think it is to do with ' &
k' part

gregor
 
Last edited:
try this??

"[surname] ='" & k & "'"
 
rainman has a good point

also just try

k=text78

not

k = me.text78.text

add a msgbox(k) while testing it, just to make sure its set correctly
 
hi nether worked ?

text78

or

"'" system, still same error
 
did you put

"[surname] =' " & k & " ' "

Not forgetting the one ' after the =

??
 
Yeah I did and still same error the K variable get set to the right string, whatever I type in the box, but it wont type match with the [surname] field on the new form, is it because the [surname] field is on the other form ? and there is a surname filed on the present form ? I can't get it to work
One form has a text box that you type in text, a search string for another form. When the keydown event occurs, if is it Enter the code should take the string and open the new form at that record [surname] that matches the sting ???

gregor
 

Users who are viewing this thread

Back
Top Bottom