Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: Thu, 14 Feb 2008 14:33:01 -0800,    group: microsoft.public.exchange.design        back       


ADO queries always fail?   
Here's my code, verbatim:

conn = ("Provider=Microsoft.Jet.OLEDB.4.0;Exchange 4.0;MAPILEVEL=Public 
Folders|All Public Folders;DATABASE=C:\\Temp\\;")
Set rstEmails = New ADODB.Recordset
rstEmails.Open "SELECT * FROM pricing WHERE ""Has Attachments""=1", conn, 
adOpenStatic, adLockReadOnly
While Not rstEmails.EOF
     Debug.Print rstEmails!Subject
     rstEmails.MoveNext
Wend

The "pricing" folder has three files in it, two of which have attachments. I 
want to get all of the ones that have attachments.

Most of what I trye after the ""Has Attachments""= returns a data type 
mismatch...

""Has Attachments""=1
""Has Attachments""=yes

The only one that works is...

""Has Attachments""=true

But when I use that, I get all the messages, not just the ones with the 
attachments. So I tried another tack..

    rstEmails.Open "SELECT * FROM pricing WHERE recieved>='" & date & "'", 
conn, adOpenStatic, adLockReadOnly

data type mismatch.

Is there some secret I need to know?

Maury
date: Thu, 14 Feb 2008 14:33:01 -0800   author:   Maury Markowitz

RE: ADO queries always fail?   
"Maury Markowitz" wrote:

Ok, even weirder... I sent a message with the body text "test". When I open 
the folder as a linked table, I can see a column called "Body", and for that 
message, it says "test". So, let's query that...

 rstEmails.Open "SELECT * FROM pricing WHERE Body='test'", conn, 
adOpenStatic, adLockReadOnly

Returns EOF.

Huh?

Maury
date: Thu, 14 Feb 2008 14:43:01 -0800   author:   Maury Markowitz

RE: ADO queries always fail?   
Geez, finally got it. Square braces only, ""'s don't work. Urg.

Maury
date: Thu, 14 Feb 2008 14:49:01 -0800   author:   Maury Markowitz

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us