Hi All!
I have a strange beahaviour here, and I can't find the cause of it.
First of all, don't pay attention to the ";" after " it is added by the froum and does not appear in my code.
I have a table (ket's say it has 2 fields, to simplify), with a website url (field : [website] text 255) and an email address (field : text 255).
I want to compare the part of the url that is after the "[URL unfurl="true"]www."[/URL] with the part of the email that is after the "@". It will not always work of course, but that is not the point. Here is my query :
SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website, Mid(email,InStr(email,"@"+1) AS truncated_email
FROM theTable
WHERE (theTable.website Is Not Null) AND (theTable.email Is Not Null) AND (Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] <> Mid(email,InStr(email,"@"+1))
So I get a 'Data type mismatch in criteria expression when I try to execute this query.
Here is what I tried :
1/
SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website, Mid(email,InStr(email,"@"+1) AS truncated_email
FROM theTable
WHERE (theTable.website Is Not Null) AND (theTable.email Is Not Null)
That gives me a result with not empty field, and it works fine.
2/
SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website, Mid(email,InStr(email,"@"+1) AS truncated_email, Vartype(Mid(website,InStr(website,"[URL unfurl="true"]www."+4))[/URL] As TypeOfUrl, Vartype(Mid(email,InStr(email,"@"+1)) As TypeOfEmail
FROM theTable
WHERE (theTable.website Is Not Null) AND (theTable.email Is Not Null)
That gives me a table with no empty field, and both TypeOfUrl and TypeOfEmail are always 8 (that means that truncated_website and truncated_email are always string values).
3/ Replacing "<>" with "not like" or with a StrComp(...)<>0 does not help, always a "Data type mismatch"
Now it gets really weird :
4/ SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website
FROM theTable
WHERE (theTable.website Is Not Null) AND Vartype(Mid(website,InStr(website,"[URL unfurl="true"]www."+4))[/URL] <> 8
Gives me a "Data Type Mismath" !!!
So maybe some website don't match "[URL unfurl="true"]www."[/URL] :
5/ DELETE * FROM theTable where website not like "*[URL unfurl="true"]www.*"[/URL]
10 lines deleted, but still the same problem...
Now I am out of idea !!!
Any help would be appreciated !
I forgot to mention tha I definitively could this around with some code or by using some temporary table, but want i really want is to understand what is happen,ing!
Thansk a lot !
I have a strange beahaviour here, and I can't find the cause of it.
First of all, don't pay attention to the ";" after " it is added by the froum and does not appear in my code.
I have a table (ket's say it has 2 fields, to simplify), with a website url (field : [website] text 255) and an email address (field : text 255).
I want to compare the part of the url that is after the "[URL unfurl="true"]www."[/URL] with the part of the email that is after the "@". It will not always work of course, but that is not the point. Here is my query :
SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website, Mid(email,InStr(email,"@"+1) AS truncated_email
FROM theTable
WHERE (theTable.website Is Not Null) AND (theTable.email Is Not Null) AND (Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] <> Mid(email,InStr(email,"@"+1))
So I get a 'Data type mismatch in criteria expression when I try to execute this query.
Here is what I tried :
1/
SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website, Mid(email,InStr(email,"@"+1) AS truncated_email
FROM theTable
WHERE (theTable.website Is Not Null) AND (theTable.email Is Not Null)
That gives me a result with not empty field, and it works fine.
2/
SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website, Mid(email,InStr(email,"@"+1) AS truncated_email, Vartype(Mid(website,InStr(website,"[URL unfurl="true"]www."+4))[/URL] As TypeOfUrl, Vartype(Mid(email,InStr(email,"@"+1)) As TypeOfEmail
FROM theTable
WHERE (theTable.website Is Not Null) AND (theTable.email Is Not Null)
That gives me a table with no empty field, and both TypeOfUrl and TypeOfEmail are always 8 (that means that truncated_website and truncated_email are always string values).
3/ Replacing "<>" with "not like" or with a StrComp(...)<>0 does not help, always a "Data type mismatch"
Now it gets really weird :
4/ SELECT Mid(website,InStr(website,"[URL unfurl="true"]www."+4)[/URL] AS truncated_website
FROM theTable
WHERE (theTable.website Is Not Null) AND Vartype(Mid(website,InStr(website,"[URL unfurl="true"]www."+4))[/URL] <> 8
Gives me a "Data Type Mismath" !!!
So maybe some website don't match "[URL unfurl="true"]www."[/URL] :
5/ DELETE * FROM theTable where website not like "*[URL unfurl="true"]www.*"[/URL]
10 lines deleted, but still the same problem...
Now I am out of idea !!!
Any help would be appreciated !
I forgot to mention tha I definitively could this around with some code or by using some temporary table, but want i really want is to understand what is happen,ing!
Thansk a lot !