[AccessD] Filtering a screen

Dan Waters dwaters at usinternet.com
Wed Aug 19 10:59:55 CDT 2009


Try using Replace like this,

X = Replace(Me.cboCustomerHead.Column(0),"'", "''")

This replaces one apostrophe with two, which will hopefully prevent the
error.

Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dale Kalsow
Sent: Wednesday, August 19, 2009 10:50 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Filtering a screen

Good Morning,
 
I am filtering the records on the screen with the following code:
 
If Me.cboCustomerHead.Column(0) = "" Then
        Me.FilterOn = False
    Else
        Me.Filter = "tblCustomerToOwner.Customer = '" &
Me.cboCustomerHead.Column(0) & "'"
        Me.FilterOn = True
    End If
 
This works great but sometimes the item in the cboCustomerHead has a single
quote in which then causes an erorr.  Does anyone know how I can filter
using an item with a single quote?
 
Thanks!
 
Dale


      
-- 
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