Its been done to death - I know but """" Again!

K

Kahuna

I need to create a query to check one field for extra ' " ' (speech quotes).
Its a field with diameters such as 16" or 20" etc.

I have discovered some entries with double quotes erroneously i.e. 16"" and
20"".

I need to check for these errors. My tack would be to find the position of
the first ' " ' and then check for a similar character in the next left
character along.

But as usual - I cant get the quotes right in the definition:

Mid([diameter], Len([diameter]),1) = 'Quotes' ('"' or """ or """")?

&

Mid([diameter], Len([diameter])-1,1) = 'Quotes'


Any help gratefully received.

Cheers
 
M

Marshall Barton

Kahuna said:
I need to create a query to check one field for extra ' " ' (speech quotes).
Its a field with diameters such as 16" or 20" etc.

I have discovered some entries with double quotes erroneously i.e. 16"" and
20"".

I need to check for these errors. My tack would be to find the position of
the first ' " ' and then check for a similar character in the next left
character along.

But as usual - I cant get the quotes right in the definition:

Mid([diameter], Len([diameter]),1) = 'Quotes' ('"' or """ or """")?

&

Mid([diameter], Len([diameter])-1,1) = 'Quotes'


I think this would be a lot easier if you just used the
Replace function:
Replace(diameter, """""", """")
 
K

Kahuna

Sorry Marshall, should have said its A97 - don't think I have a Replace
Function. There has to be a simpler way than creating a Replace Function
too.

I have the query column showing the content and all I need to do is say 'Is
this content = " '.

SELECT fabric_condition.fc_id, fabric_condition.fc_diameter,
Mid([fc_diameter],Len([fc_diameter]),1) AS FindString,
Mid([fc_diameter],Len([fc_diameter])-1,1) AS FindString2
FROM fabric_condition
WHERE (((fabric_condition.fc_diameter) Is Not Null) AND
((Mid([fc_diameter],Len([fc_diameter]),1))<>"));

Is it possible to use CHR(34) to do this check somehow?
--
Kahuna
------------
Marshall Barton said:
Kahuna said:
I need to create a query to check one field for extra ' " ' (speech
quotes).
Its a field with diameters such as 16" or 20" etc.

I have discovered some entries with double quotes erroneously i.e. 16""
and
20"".

I need to check for these errors. My tack would be to find the position of
the first ' " ' and then check for a similar character in the next left
character along.

But as usual - I cant get the quotes right in the definition:

Mid([diameter], Len([diameter]),1) = 'Quotes' ('"' or """ or """")?

&

Mid([diameter], Len([diameter])-1,1) = 'Quotes'


I think this would be a lot easier if you just used the
Replace function:
Replace(diameter, """""", """")
 
K

Kahuna

Got a workaround here - but its not really satisfying!

SELECT fabric_condition.fc_diameter,
InStr(1,Mid([fc_diameter],Len([fc_diameter])-1,1),"""")>0 AS Test
FROM fabric_condition
WHERE (((fabric_condition.fc_diameter) Is Not Null));

Checking the second character from the right and if that's a ' " ' then we
know the entry is ill formed.

Any constructive comments would be welcome.
--
Kahuna
------------
Marshall Barton said:
Kahuna said:
I need to create a query to check one field for extra ' " ' (speech
quotes).
Its a field with diameters such as 16" or 20" etc.

I have discovered some entries with double quotes erroneously i.e. 16""
and
20"".

I need to check for these errors. My tack would be to find the position of
the first ' " ' and then check for a similar character in the next left
character along.

But as usual - I cant get the quotes right in the definition:

Mid([diameter], Len([diameter]),1) = 'Quotes' ('"' or """ or """")?

&

Mid([diameter], Len([diameter])-1,1) = 'Quotes'


I think this would be a lot easier if you just used the
Replace function:
Replace(diameter, """""", """")
 
J

John Spencer

Pardon me,

If all you want to do is return those records then I would use

SELECT fabric_condition.fc_id, fabric_condition.fc_diameter,
Mid([fc_diameter],Len([fc_diameter]),1) AS FindString,
Mid([fc_diameter],Len([fc_diameter])-1,1) AS FindString2
FROM fabric_condition
WHERE fc_diameter Like "*" & Chr(34) & Chr(34) & "*"

You could try the where clause as
Where fc_Diameter Like '*""*'

Kahuna said:
Sorry Marshall, should have said its A97 - don't think I have a Replace
Function. There has to be a simpler way than creating a Replace Function
too.

I have the query column showing the content and all I need to do is say
'Is this content = " '.

SELECT fabric_condition.fc_id, fabric_condition.fc_diameter,
Mid([fc_diameter],Len([fc_diameter]),1) AS FindString,
Mid([fc_diameter],Len([fc_diameter])-1,1) AS FindString2
FROM fabric_condition
WHERE (((fabric_condition.fc_diameter) Is Not Null) AND
((Mid([fc_diameter],Len([fc_diameter]),1))<>"));

Is it possible to use CHR(34) to do this check somehow?
--
Kahuna
------------
Marshall Barton said:
Kahuna said:
I need to create a query to check one field for extra ' " ' (speech
quotes).
Its a field with diameters such as 16" or 20" etc.

I have discovered some entries with double quotes erroneously i.e. 16""
and
20"".

I need to check for these errors. My tack would be to find the position
of
the first ' " ' and then check for a similar character in the next left
character along.

But as usual - I cant get the quotes right in the definition:

Mid([diameter], Len([diameter]),1) = 'Quotes' ('"' or """ or """")?

&

Mid([diameter], Len([diameter])-1,1) = 'Quotes'


I think this would be a lot easier if you just used the
Replace function:
Replace(diameter, """""", """")
 
M

Marshall Barton

Kahuna said:
Got a workaround here - but its not really satisfying!

SELECT fabric_condition.fc_diameter,
InStr(1,Mid([fc_diameter],Len([fc_diameter])-1,1),"""")>0 AS Test
FROM fabric_condition
WHERE (((fabric_condition.fc_diameter) Is Not Null));

Checking the second character from the right and if that's a ' " ' then we
know the entry is ill formed.


I think you are over simplifying your problem.

This is probably not sufficient either, but if you want to
find all records that are not a bunch or digits followed
by a single " mark:

SELECT fc_diameter,
FROM fabric_condition
WHERE fc_diameter Like "*[!0-9]*?"
Or Right(fc_diameter ,1) <> """"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top