473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

DLookup and single and double quotes

Hello all,

I'm using A97.

Say I've got a table "myTable" with two fields: "PK" and "Description"

Say my table has three rows:

PK Description
1 Elvis "The King" Presley
2 Jack "C'mon" Black
3 Bob "The Wonder" Dylan

My question is: How can I use de DLookup function to find the PK if I'm
searching for a Description with both single and double quote in it?

Ex: myPK = DLookUp("PK", "myTable", "Description = ??? )

Thanks for your help.

Yannick
Nov 13 '05 #1
1 2979
You're going to have some fun but ...
First off - strings are surrounded by single quotes
Then - double up all your quotes - both types

Sub Test()
Dim varAnswer As Variant
varAnswer = DLookup("PK", "myTable", "[Description]= 'Bob ""The
Wonder"" Dylan'")
If Not IsNull(varAnswer) Then
MsgBox "First one is: " & varAnswer
Else
MsgBox "Error finding first item"
End If
varAnswer = DLookup("PK", "myTable", "[Description]= 'Jack ""C''mon""
Black'")
If Not IsNull(varAnswer) Then
MsgBox "Second one is: " & varAnswer
Else
MsgBox "Error finding second item"
End If
End Sub

I hope this helps
Billie Dee

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to...
11
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into...
6
by: JLM | last post by:
What am I missing here? I have a form where I enter a "Class Code". This value corresponds to what sits in table "class code descriptions" along with the "title" of each "class code." Key...
1
by: Thelma Lubkin | last post by:
I am still struggling with trying to match a user supplied string with strings in a field of a table, where spaces are to be ignored. Arno suggested that I use the Dlookup function, but I...
3
by: Tempy | last post by:
Hi all, i am running into problems with a DLookUp below: =DLookUp("","tblBuyerTotals"," =' " & me!LastName) This is in the Control Source of a text box on the same form. "LastName" is a text...
1
by: Tony Ciconte | last post by:
I am using Acc97 and trying to get the following instruction to work in the OnOpen event of a report: DLookup("", "tblTempRevenueByFY", DatePart("m", ) = 1) The table tblTempRevenueByFY...
13
by: nzyui | last post by:
Trying to lookup a field from a table called condition this is a separate table not linked to anything: setup as shown Code S M L DG 1 2 3 RI 2 4 5 need...
2
by: chris.thompson13 | last post by:
I am having a problem setting the criteria part of the DLookup method correctly and am consequently getting an error message. I have a database of staff duties, part of which is a query (qryDaily)...
2
by: Denise | last post by:
Front end is Access 2002, back end is linked Oracle tables. My users need to describe things in feet and inches and want to use the standard ' and " abbrevations. On a testing form I go to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.