[AccessD] Preventing Extra Excel instances SOLVED

John Colby jwcolby at ColbyConsulting.com
Sat Oct 29 13:22:15 CDT 2005


I like it!  Thanks.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Friday, October 28, 2005 3:26 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Preventing Extra Excel instances SOLVED


JC, perhaps my solution will work for you. I use a pair of functions that I
call q() and qq(), which stand for single and double quotes. 
Public Function q(str As String) As String
    q = Chr(39) & str & Chr(39)
End Function

Public Function qq(str As String) As String
    q = Chr(34) & str & Chr(34)
End Function
Then for any column that may contain an apostrophe, you can just write 
SELECT q(ColumName) from MyTable
Without even bothering to check whether there are apostrophes. You just stop
worrying about it.

Arthur
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Colby
Sent: October 26, 2005 8:18 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Preventing Extra Excel instances SOLVED

I had one today...

I build a SQL statement as the recordsource for a form.  I am dynamically
building up a where clause where I substitute in the field name and value in
the where clause.  A name ( O'Doule or some such) has an apostrophe in it.
As you know, the ' is the syntax for enclosing text strings in a SQL
statement when doing this.... 

	"Some SELECT HERE" & _
	"WHERE SomeField = '" & strSomeValue & "';"

In many of the computers at the client, when I append the SQL string in the
form's recordsource with an ' in the middle, instead of a run time error,
Access gives a warning and shuts down.  On my machine it correctly gives a
runtime error.

I am SOOOOooooo tired of this buggy program.

John W. Colby
www.ColbyConsulting.com 

Contribute your unused CPU cycles to a good cause:
http://folding.stanford.edu/

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list