Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-22-2015, 08:02 PM
macropod's Avatar
macropod macropod is offline Merge Object and not displaying Access Queries with VBA Windows 7 64bit Merge Object and not displaying Access Queries with VBA Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,387
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could add the SQL Statement to the OpenDataSource method. The OpenDataSource method takes the following parameters:
Name, Format, ConfirmConversions, ReadOnly, LinkToSource, AddToRecentFiles, PasswordDocument, PasswordTemplate, Revert, WritePasswordDocument, WritePasswordTemplate, Connection, SQLStatement, SQLStatement1, OpenExclusive, SubType

You'll see two SQLStatement references - SQLStatement & SQLStatement1. SQLStatement accepts query strings of up to 255 characters. If the query string is longer than 255 characters, SQLStatement specifies the first portion of the string, and SQLStatement1 specifies the second portion.

You can export the current parameters to a new document, using code like:
Code:
Sub Test()
Dim StrMMData As String, DocTmp As Document
With ActiveDocument.MailMerge
  If .MainDocumentType <> wdNotAMergeDocument Then
    StrMMData = StrMMData & "Mail Merge Data Source Name:" & vbCr & .DataSource.Name & vbCr
    StrMMData = StrMMData & "Mail Merge Connect String:" & vbCr & .DataSource.ConnectString
    StrMMData = StrMMData & vbCr & "Mail Merge Query String:" & vbCr & .DataSource.QueryString
    Set DocTmp = Documents.Add
    DocTmp.Range.Text = StrMMData
  Else
    MsgBox "Not A Merge Document"
  End If
End With
End Sub
As for the necessity to use DDE, I suggest you verify that on a specialist Access forum (e.g. http://www.accessforums.net/)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge Object and not displaying Access Queries with VBA Excel worksheet as OBJECT in WORD not displaying mohsin Word 1 03-27-2012 10:43 PM
Merge Object and not displaying Access Queries with VBA Mailmerge with Access queries optiontips.in Mail Merge 2 11-21-2011 03:12 AM
mail merge queries not displaying donwalt Mail Merge 0 09-05-2010 02:41 PM
Merge Object and not displaying Access Queries with VBA flash shockwave object not displaying webguync PowerPoint 7 04-20-2010 07:23 AM
Access Object library 10 Gyto Office 0 10-09-2008 09:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:15 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft