Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Extracting data from Access

I am having problems with apostrophes...

I'm in Excel, and using Excel VBA, I utilize an ADODB connection to get data
out of Access

The user enters a company name (eg, General Motors), and all the deals for
General Motors are returned.

The simplified line of SQL is:
HAVING (((Deals.Company)="General Motors"));

But in Excel VBA, the quotations are changed for apostrophes
HAVING (((Deals.Company)='General Motors'));

And I use a variable, rather than the company name
[Earlier]
myCompany= InputBox("What company?")
[Later]
HAVING (((Deals.Company)="'" & myParent & "'"));

This works for 99% of my companies, but not for companies with an apostrophe
in it. eg "Foster's Group". For this company, I get an error when I come to
extract the data.

Can anyone advise me how to handle this variation?

Thanks
Daniel






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Extracting data from Access

Can you post your entire SQL code. Seems like you should just replace
all the Foster's examples without the ' s.

Stopher

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting data from Access - error encountered Daniel Bonallack Excel Programming 2 August 2nd 06 07:16 AM
Extracting from Access Daniel Bonallack Excel Programming 4 April 5th 05 09:05 PM
Extracting Excel Formulas into Access Novelty[_2_] Excel Programming 0 October 26th 04 11:40 PM
Extracting Excel data and uploading to access JBP Excel Programming 1 January 23rd 04 07:42 PM
Extracting Access data Tom Brooks Excel Programming 0 July 8th 03 02:41 PM


All times are GMT +1. The time now is 03:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"