Problem with apostroph

  • Thread starter Thread starter Audiss=?ISO-8859-1?B?6Q==?=e
  • Start date Start date
A

Audiss=?ISO-8859-1?B?6Q==?=e

Hello

First, appologies for my bad english.

I need help for the following problem. I'm using the Dlookup method to help
filling a field :

me![Name] = DLookUp("[Name]", "[Table_contact]","[Surname]= '" &
me![Surname] & "'")

This is the good syntax, but the problem is that it return nothing if the
field me![Surname] contains the character '. Otherwise, it is OK.

How can I solve this problem?

Thanks for help

Stephane DAYNAC
 
Audissée said:
Hello

First, appologies for my bad english.

I need help for the following problem. I'm using the Dlookup method to help
filling a field :

me![Name] = DLookUp("[Name]", "[Table_contact]","[Surname]= '" &
me![Surname] & "'")

This is the good syntax, but the problem is that it return nothing if the
field me![Surname] contains the character '. Otherwise, it is OK.

How can I solve this problem?

Thanks for help

Stephane DAYNAC


You can use chr(34) to sobstitute "'"......!
Procedure=DLookUp("[Name]", "[Table_contact]","[Surname]= " & chr(34) &
me![Surname] & chr(34))

Good evening.
Alessandro(IT).
 
Audissée said:
Hello

First, appologies for my bad english.

I need help for the following problem. I'm using the Dlookup method to help
filling a field :

me![Name] = DLookUp("[Name]", "[Table_contact]","[Surname]= '" &
me![Surname] & "'")

This is the good syntax, but the problem is that it return nothing if the
field me![Surname] contains the character '. Otherwise, it is OK.

How can I solve this problem?

Thanks for help

Stephane DAYNAC

In addition to Allesandro's excellent reply, if you really have a field
named [Name] I would strongly suggest you change it. Name is a reserved
Access/VBA word and should never be used as a field name.

Take a look at the appropriate KnowledgeBase article for your version of
Access.

109312 'Reserved Words in Microsoft Access'
209187 'Acc2000: 'Reserved Words in Microsoft Access'
286335 'ACC2002: Reserved Words in Microsoft Access'
 
Hello every one

First, thanks for the answer.
The name of examples i have send with my mail are for exemple only. The reel
names I use are not reserved words.

But I'm not sure I have explain the problem correctly. It is not the name of
controls or objets that make the problem. It is their content.

I take another example :

me![The_name] = DLookUp("[The_name-target]", "[Table_target]","[The
Surname_target]= '" & me![The_surname] & "'")

I have this programmation on an after update field call The_Surname.
It has to search the corresponding name ("The_name_target") in the Table
called "Table_target" to automatically fill the current form field
"The_name".

We supposed "The_surname" to be a key field in the "Table_contact".
So, for every "The-Surname" correspond only one "The_name".
It'll be difficult to explain briefly but I don't want to use the
traditionnal relation between Table to obtain The_name.


If The_surname = Dupond, it return the corresponding name "The_name" of
Mister Dupond

If the_surname = O'Brien, it doesn't work because of the character'.

Every time the name contain the character ' Dlookup return nothing.

And it's problematic to limit the_surname to have no " ' " in it.

I hope the explanation are clear and thanks to every one for according some
time to read my mail and respond

Sincerly

Stéphane
 
Try:

Me![The_name] = DLookUp("[The_name-target]", "[Table_target]",
"[The Surname_target]= " & Chr$(34) & Me![The_surname] & Chr$(34))
 
Dear stephane

Use
me![Name] = DLookUp("[Name]", "[Table_contact]","[Surname]=" & chr$(34) &
me![Surname] & Chr$(34) )

This Allways works for me

Yours Alan
 
Audissée said:
Hello every one

First, thanks for the answer.
The name of examples i have send with my mail are for exemple only. The reel
names I use are not reserved words.

But I'm not sure I have explain the problem correctly. It is not the name of
controls or objets that make the problem. It is their content.

I take another example :

me![The_name] = DLookUp("[The_name-target]", "[Table_target]","[The
Surname_target]= '" & me![The_surname] & "'")

I have this programmation on an after update field call The_Surname.
It has to search the corresponding name ("The_name_target") in the Table
called "Table_target" to automatically fill the current form field
"The_name".

We supposed "The_surname" to be a key field in the "Table_contact".
So, for every "The-Surname" correspond only one "The_name".
It'll be difficult to explain briefly but I don't want to use the
traditionnal relation between Table to obtain The_name.


If The_surname = Dupond, it return the corresponding name "The_name" of
Mister Dupond

If the_surname = O'Brien, it doesn't work because of the character'.

Every time the name contain the character ' Dlookup return nothing.

And it's problematic to limit the_surname to have no " ' " in it.

I hope the explanation are clear and thanks to every one for according some
time to read my mail and respond

Sincerly

Stéphane

Stephane,
Did you even try Allesandro's reply?
And I see that Van Dinh has given you the same answer.
Now, for the third time:
=DLookUp("[The_name-target]", "[Table_target]","[The Surname_target]= "
& chr(34) & me![The_surname] & chr(34))
Try it.
 
Thanks a lot for the answer.
Using two consecutive " characters solve the problem.

me![The_name] = DLookUp("[The_name-target]", "[Table_target]","[The
Surname_target]= """ & me![The_surname] & """")

Sincerly

Stéphane

De : "Van T. Dinh" <[email protected]>
Groupes : microsoft.public.access.forms
Date : Mon, 22 Dec 2003 20:22:02 +1100
Objet : Re: Problem with apostroph

Try:

Me![The_name] = DLookUp("[The_name-target]", "[Table_target]",
"[The Surname_target]= " & Chr$(34) & Me![The_surname] & Chr$(34))

--
HTH
Van T. Dinh
MVP (Access)



Audissée said:
Hello every one

First, thanks for the answer.
The name of examples i have send with my mail are for exemple only. The reel
names I use are not reserved words.

But I'm not sure I have explain the problem correctly. It is not the name of
controls or objets that make the problem. It is their content.

I take another example :

me![The_name] = DLookUp("[The_name-target]", "[Table_target]","[The
Surname_target]= '" & me![The_surname] & "'")

I have this programmation on an after update field call The_Surname.
It has to search the corresponding name ("The_name_target") in the Table
called "Table_target" to automatically fill the current form field
"The_name".

We supposed "The_surname" to be a key field in the "Table_contact".
So, for every "The-Surname" correspond only one "The_name".
It'll be difficult to explain briefly but I don't want to use the
traditionnal relation between Table to obtain The_name.


If The_surname = Dupond, it return the corresponding name "The_name" of
Mister Dupond

If the_surname = O'Brien, it doesn't work because of the character'.

Every time the name contain the character ' Dlookup return nothing.

And it's problematic to limit the_surname to have no " ' " in it.

I hope the explanation are clear and thanks to every one for according some
time to read my mail and respond

Sincerly

Stéphane
 
Dear stephane

Use
me![Name] = DLookUp("[Name]", "[Table_contact]","[Surname]=" & chr$(34) &
me![Surname] & Chr$(34) )

This Allways works for me

Yours Alan
 
Dear stephane

Use
me![Name] = DLookUp("[Name]", "[Table_contact]","[Surname]=" & chr$(34) &
me![Surname] & Chr$(34) )

This Allways works for me

Yours Alan
 
fredg said:
Audissée wrote:
[CUT]

Stephane,
Did you even try Allesandro's reply?
And I see that Van Dinh has given you the same answer.
Now, for the third time:
=DLookUp("[The_name-target]", "[Table_target]","[The Surname_target]= "
& chr(34) & me![The_surname] & chr(34))
Try it.Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.


It's christams time.....!! ;-)
Hi Fred.

Merry Christmas.
Alessandro(IT).
 
This solve the problem too:

me![Name] = DLookUp("[Name]", "[Table_contact]","[Surname]=" & chr$(34) &
me![Surname] & Chr$(34) )

Many Thanks to Alan, Alessandro, Fredg and Van T dinh

Merry Christmas
De : "ALESSANDRO Baraldi" <[email protected]>
Société : Tiscali Spa
Groupes : microsoft.public.access.forms
Date : Tue, 23 Dec 2003 14:00:26 +0100
Objet : Re: Problem with apostroph


fredg said:
Audissée wrote:
[CUT]

Stephane,
Did you even try Allesandro's reply?
And I see that Van Dinh has given you the same answer.
Now, for the third time:
=DLookUp("[The_name-target]", "[Table_target]","[The Surname_target]= "
& chr(34) & me![The_surname] & chr(34))
Try it.Fred
Please reply only to this newsgroup.
I do not respond to personal e-mail.


It's christams time.....!! ;-)
Hi Fred.

Merry Christmas.
Alessandro(IT).
 
Back
Top