If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Printing Problems

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-05-04, 13:20
tainter tainter is offline
Registered User
 
Join Date: Feb 2004
Posts: 3
Printing Problems

Ok so from one problem to the other. So my query searches for records that dont have an X in the field or null. So when I run my mail merge it gives 1 record which is right...but it prints all other record with blank data. The only data I want to run is where an "X" is in the BatchRan field!

Here is the SQL statement

tSql = "SELECT * FROM data.xls WHERE (BatchRan Is Null)" & ""

'Open the Datasource
wrdDoc.MailMerge.OpenDataSource Name:="data.xls", _
ConfirmConversions:=False, LinkToSource:=True, ReadOnly:=True, _
Format:=wdOpenFormatAuto, Connection:="Computer Data", _ SQLStatement:="", SQLStatement1:=""

'Setup Mail Merge
With wrdDoc.MailMerge
With .DataSource
.QueryString = tSql
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
.Execute Pause:=True
End With

Thanks for the help

Tainter
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On