Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

Use QBE Grid with Double-Quotes and/or Apostrophe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ryguy7272 - 23 Apr 2008 17:51 GMT
In the QBE Grid, with Like "INT'L" in Criteria, my Query works fine.  It
fails when I try to create a dynamic Query with this VBA:

' Build criteria string for Broker
For Each varItem In Me.lstBroker.ItemsSelected
strBroker = strBroker & ",'" & Me.lstBroker.ItemData(varItem) & "'"
Next varItem
If Len(strBroker) = 0 Then
strBroker = "Like " * ""
Else
strBroker = Right(strBroker, Len(strBroker) - 1)
strBroker = "IN(" & strBroker & ")"
End If

I’m sure it has to do with the ‘ in the INT’L.  I tried quotes and
double-quotes, like this:
strBroker = "Like " * ""

Can’t seem to quite get it working though.

Can anyone see what the problem is?

Regards,
Ryan---

Signature

RyGuy

Jeanette Cunningham - 23 Apr 2008 23:35 GMT
Ryan,
the general idea is to use 3 double quotes instead of one double quote, one
single quote and another double quote
Separated for clarity that is:
Use " " "   instead of " ' "

use  """ & Me.lstBroker.ItemData(varItem) & """
instead of
'" & Me.lstBroker.ItemData(varItem) & "'

Jeanette Cunningham

> In the QBE Grid, with Like "INT'L" in Criteria, my Query works fine.  It
> fails when I try to create a dynamic Query with this VBA:
[quoted text clipped - 20 lines]
> Regards,
> Ryan---
ryguy7272 - 24 Apr 2008 06:04 GMT
BRILLIANT!!  

Thanks for the help last time and thanks for the help this time!!

Ryan--
PS, thanks, in advance, for the help next time...there will probably be a
next time as well...

Signature

RyGuy

> Ryan,
> the general idea is to use 3 double quotes instead of one double quote, one
[quoted text clipped - 32 lines]
> > Regards,
> > Ryan---
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.