Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 01-04-2016, 06:43 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

I tried copying the sqlstatement provided by a manual mail-merge but it still will not look at the queries with the VBA code.

Macropod. I apologize. I'm very new to Office coding and so really all I'm wanting to do is part of the 'run the document' code I have is to have it automatically open up the mail-merge prompts including the connection type.

We have about 12 different queries (one for each program manager) that links to the same table. I wanted them to manually select their own query (or someone elses, if they're filling in) from a list of all the queries.

Really I just want when I have the code say 'run the mail merge' that all the boxes pop up as if I'd hit the button. If there's a specific SQLString that does that I'll give it a try the one I copied doesn't seem to do the DDE connection so the queries with VBA functions don't appear.

The code that will use what I'm trying to do is here:

Quote:
Private Sub RUN_Click()
Dim DBLoc As String
If FundSource.Value = "" Or FedFunds.Value = "" Or Match.Value = "" Or ServiceCharges.Value = "" Or Equipment.Value = "" Or DiscloseInfo.Value = "" Or FFATA.Value = "" Then
MsgBox ("ERROR: One or more option fields are blank. All fields must be set.")
Else
With ActiveDocument.CustomDocumentProperties
.Add Name:="FundSource", Type:=msoPropertyTypeString, Value:=FundSource.Value, LinkToContent:=False
.Add Name:="FedFunds", Type:=msoPropertyTypeString, Value:=FedFunds.Value, LinkToContent:=False
.Add Name:="Match", Type:=msoPropertyTypeString, Value:=Match.Value, LinkToContent:=False
.Add Name:="ServiceCharges", Type:=msoPropertyTypeString, Value:=ServiceCharges.Value, LinkToContent:=False
.Add Name:="Equipment", Type:=msoPropertyTypeString, Value:=Equipment.Value, LinkToContent:=False
.Add Name:="DiscloseInfo", Type:=msoPropertyTypeString, Value:=DiscloseInfo.Value, LinkToContent:=False
.Add Name:="FFATA", Type:=msoPropertyTypeString, Value:=FFATA.Value, LinkToContent:=False
.Add Name:="DBYear", Type:=msoPropertyTypeString, Value:=DBYear.Value, LinkToContent:=False
End With
ActiveDocument.Fields.Update
'MSGBOX will change text/move location/as more parts of the code work.
MsgBox ("Contract Created. Double Check Margins.")
‘MAIL MERGE CODE HERE
With Application.Dialogs(wdDialogFileSaveAs)
.Name = "h:\RDS\ASSESS\Program Files\#UNK AGENCY NAME Unsigned Contract.doc"
.Format = wdFormatDocument
.Show
End With
Unload Me
End If
End Sub
Reply With Quote
 

Thread Tools
Display Modes


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 09:40 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