Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
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,521
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
  #2  
Old 12-28-2015, 06:20 AM
jmo jmo is offline Merge Object and not displaying Access Queries with VBA Windows 7 32bit Merge Object and not displaying Access Queries with VBA Office 2010 32bit
Novice
Merge Object and not displaying Access Queries with VBA
 
Join Date: Dec 2015
Posts: 7
jmo is on a distinguished road
Default Merge Object and not displaying Access Queries with VBA

Thank you, Macropod.

Do you know what SQL statements I would add to open up a window that displays all the queries/tables in a particular database? Leaving that statement blank seems to accomplish this, but does not seem to solve my problem.

I've tried toggling several settings to get the window that asks you to manually confirm the file connection so I can select DDE (which is what happens when the 'Confirm File Conversation..' advanced option is checked).

Essentially I'm wanting the window that opens that is done automatically when you follow the steps in this post: https://www.msofficeforums.com/mail-...ps-tricks.html (under Mail Merge Data Format Problems).
Reply With Quote
Reply



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 12:20 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