DLookup for Irish people ??

G

Guest

MY wonderfull on-line access booking system (tested for ages) has just
failed on the third application. Why ? An Irish person (booking from
someone in Dublin) named Mr O'Rourke

strID = Nz(DLookup("[CDClientID]", "[TblClients]", "[CD1stName] ='" &
Form!txt1stName & "' AND [CDSurname] = '" & Form!txtSurname & "'AND
[CDDateofBirth] = " & Format(Form!frmNewBookings!txtDateofBirth,
"\#yyyy\-mm\-dd\#")), "0")
Helped by Douglas Steel and John Vinson

Has anyone an idea of how to amend the above to cope with O'Rourke,
O'Donnel, M'Clishe or even O'Shuanasey'Smith.

The lookup is looking for 'ORourke', and the extra apostrophe is making this
2 words - Mr O and Mr Rourke

Any tips would be really helpful
 
A

Allen Browne

Use the double-quote character, doubled up inside the quotes:

strID = Nz(DLookup("[CDClientID]", "[TblClients]", "[CD1stName] =""" &
Form!txt1stName & ""' AND [CDSurname] = """ & Form!txtSurname &
""" AND [CDDateofBirth] = " &
Format(Form!frmNewBookings!txtDateofBirth, "\#yyyy\-mm\-dd\#")), "0")

Explanation:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html
 
C

CyberDwarf

Try doing a replace of the single quote with two single quotes, before
executing the query.

NB. I am not suggesting you save the two single quotes to the database.

HTH

Steve
 
G

Guest

Hi Allen

It works perfectly

Thank you


--
Wayne
Manchester, England.



Allen Browne said:
Use the double-quote character, doubled up inside the quotes:

strID = Nz(DLookup("[CDClientID]", "[TblClients]", "[CD1stName] =""" &
Form!txt1stName & ""' AND [CDSurname] = """ & Form!txtSurname &
""" AND [CDDateofBirth] = " &
Format(Form!frmNewBookings!txtDateofBirth, "\#yyyy\-mm\-dd\#")), "0")

Explanation:
Quotation marks within quotes
at:
http://allenbrowne.com/casu-17.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Wayne-I-M said:
MY wonderfull on-line access booking system (tested for ages) has just
failed on the third application. Why ? An Irish person (booking from
someone in Dublin) named Mr O'Rourke

strID = Nz(DLookup("[CDClientID]", "[TblClients]", "[CD1stName] ='" &
Form!txt1stName & "' AND [CDSurname] = '" & Form!txtSurname & "'AND
[CDDateofBirth] = " & Format(Form!frmNewBookings!txtDateofBirth,
"\#yyyy\-mm\-dd\#")), "0")
Helped by Douglas Steel and John Vinson

Has anyone an idea of how to amend the above to cope with O'Rourke,
O'Donnel, M'Clishe or even O'Shuanasey'Smith.

The lookup is looking for 'ORourke', and the extra apostrophe is making
this
2 words - Mr O and Mr Rourke

Any tips would be really helpful
 

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

Similar Threads

DateSerial and DLookup 5

Top