Recent content by hazz_London

  1. H

    SQL query issue (MailMerge.OpenDataSource)

    Very helpful pbaldy. Using the abreviated table names gets the character count down to about 180. More importantly, it means that the query works properly. Thanks guys - this problem has been bugging me for quite a while! H
  2. H

    SQL query issue (MailMerge.OpenDataSource)

    Of course. I'll see what I can do - our database was written externally, so I will need to get full developer rights first. Hopefully that will do the trick - i'll let you know. Thanks again. H
  3. H

    SQL query issue (MailMerge.OpenDataSource)

    I see your logic. Just not entirely sure how to assign my statement to "NewQuery - would that be done in MSQuery? or can you do it directly in VBA?
  4. H

    SQL query issue (MailMerge.OpenDataSource)

    Just to be clear - each client has its own email list.
  5. H

    SQL query issue (MailMerge.OpenDataSource)

    I have a macro that runs from Outlook. That macro looks at the subject line of the current email and compares that to our client list, which is located in our Access database. The macro then opens a Word template and populates various bits of information into the template. The document is...
  6. H

    SQL query issue (MailMerge.OpenDataSource)

    Here are the debug.prints: The top one is the combined SQL statement. The lower one is the connection string. SELECT tbl001_ClientContactStatus.SecondaryMarketSup,tbl001_Contact.EmailAddress1 FROM tbl001_Contact INNER JOIN tbl001_ClientContactStatus ON tbl001_ClientContactStatus.ContactID =...
  7. H

    SQL query issue (MailMerge.OpenDataSource)

    At the moment it comes straight from the code (will eventually come from somewhere else) He is the latest version of the code. I have split the SQL into two sections (strSQL and strSQL1) to get under the 255 character limit, but it still doesn't implement both aspects of the WHERE clause. See...
  8. H

    SQL query issue (MailMerge.OpenDataSource)

    Maybe I can use both the SQLStatement and SQLStatement1 arguments of the MailMerge.OpenDataSource method. Will try to work out how that is done.
  9. H

    SQL query issue (MailMerge.OpenDataSource)

    Sorry - I've lost you. 'Name of the problem query'. I just assigned the query statement to a string (strSQL) in VBA and then passed it to the MailMerge.OpenDataSource method. I don't think it has a name (other that f&*£ing annoying statement that doesn't want to work!). I also found...
  10. H

    SQL query issue (MailMerge.OpenDataSource)

    Sorry I don't quite follow your last post. (Am still learning this VBA stuff as I go along!) Would you mind elaborating slightly? H
  11. H

    SQL query issue (MailMerge.OpenDataSource)

    I have tried Yes and -1. Both behave in the same way as True. The OpenDataSource works fine (no errors), but it just doesn't pick up the last line of the SQL statement. Interestingly, when you open up the recipients list you can manually filter the entries by "SecondaryMarketSup = TRUE"...
  12. H

    SQL query issue (MailMerge.OpenDataSource)

    Ok - just spotted something. There was an unnecessary space in the one of the 'tbl001' bits in the SELECT statement. ARG! Can't believe I didn't spot it. I have slightly changed the .OpenDataSource bit, but I don't think that was the cause of the issue. Even more annoyingly, this SQL...
  13. H

    SQL query issue (MailMerge.OpenDataSource)

    Actually - using MSQuery is no good because the ClientID will be change. I would have to use VBA to open MSQuery to build and save the query with the right ClientID. Sounds a bit messy.
  14. H

    SQL query issue (MailMerge.OpenDataSource)

    It's Word 2003 (and Access 2003). All the sources in the SQL statement refer to tables (hence tbl001 etc). As a potential work around I might try to use good old MSQuery to set up the query and then use that to drive OpenDataSource method. I just have to work out how to do that! H
  15. H

    SQL query issue (MailMerge.OpenDataSource)

    That's what I thought. It might be something to do with the way the MailMerge.OpenDataSource method is set up. It seems there might be an issue with the 'connection' bit. It just seems strange that it works with a more simply query, but not one with 2 WHERE clauses. Perhaps the way I was...
Top Bottom