简体   繁体   中英

data type mismatch in criteria expression in access

I have connected outlook mails inbox with access and then created a query, where I wrote this code:

KeyID: Str(Left(Right([Contents],Len([Contents])-InStr(1,[Contents],"-")+4),10)) 

to get a specific string from the mail subject line, which is working fine but when I am using

"Like ("xyz*")" 

in criteria section of query or creating relationship with another table taking KeyID as the reference column, getting an error:

Data type mismatch in criteria expression

when i am running the query. Your help would help to solve. Thanks.

    SELECT Inbox.Subject, 
Inbox.Contents, 
Inbox.Received, 
Inbox.[Sender Name], 
Left(Right([Contents],Len([Contents])-InStr(1,[Contents],"-"‌​)+4),10) AS KeyID 
    FROM Inbox 
    WHERE (((Left(Right([Contents],Len([Contents])-InStr(1,[Contents],‌​"-")+4),10)) Like 'OMY*')) ORDER BY Inbox.Received DESC;

我认为应该

"Like ('xyz*')" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM