Blank Address Lines In Mailmerge

Dec 27, 2007

I am trying to generate letters from ACC2003 db into Word2003. Reason for Word is so client can edit letters if required.
I have set up a maketable query to generate a temporary table in the Db and the mailmerge master document all formatted and pointed at the temporary table. I still need to get the automation running so that the letters merge and print on a command button.
My immediate issue is that the address lines are intentionally spread across 5 fields Addr1, Addr2, Addr3, Town, Postcode. Not all fields in every record are full, and with the query it would be impossible to eliminate fields on the chance they might be empty.
As a result my mailmerge has blank address lines which do not look professional.
Can anyone point me to how I might solve this given my proposed use - if it was a report then I have a little code module that neatly eliminates blank lines but I cannot see how I could integrate this into the mailmerge process.
Thanks for any help or pointers

View Replies


ADVERTISEMENT

Address Lines And Carriage Returns

Aug 11, 2007

I want my query to output an address in one field with carriage returns, where the address lines in the source table are held in individual fields.

So I try...

SELECT [Address1] & Chr$(13) & [Address2] & Chr$(13) & [Address3] etc..

This does not work.

However, if I use a text box on a form, with "New Line in Field" set, and then in code use Sendkeys to post the address and the carriage returns as above, it does work.

Can this be done simply in a query? If so how?

View 1 Replies View Related

Blank Lines

Aug 17, 2004

I am working with an access table populated from an excel spreadsheet due to its source if a person has more than one line of data the fileds are left blank.



Example:

ID Name Date diagnosis

01 Smith, David 07/01/2004 sore throat

02 Strep Throat

03 Broken arm



For Smith, David he had 3 diagnosis but the field date and name are blank as they would have been the same as ID 01. I have written a query to populate the blank fields:

IIF([name] is null, dlookup("[name]", "tblDiagnosisUnder16final","[Id]=" & [id]-1),[name]) This works great for lines with only one blank, but in the above example for ID 03 the name field stays blank as it is looking at field 02 which is blank in the table.



What I need is a loop to keep moving up the table until it finds a field that <> Null. I assum I should write a function and palce it in the if statement above where the -1 is but I am strugling with comming up with a solution.



Any help would be appreciated.



Mike

View 2 Replies View Related

Reports :: Getting Blank Lines If No Detail Records

Feb 26, 2014

I am creating a report that is organized by project. The detail lines are to list payments applied to the project. How can I skip the detail section (or print a single blank line) if there are no payments in the separate payment table that match the project ID? Is there a way to tell that there were no matching payments and format accordingly? I currently get multiple blank lines.

View 2 Replies View Related

Modules & VBA :: Getting Blank Lines In Table Even Though Form Is Unbound

Jun 24, 2013

I have created a forum that all fields are unbound. On completing it is written to the table using a RunSQL command. This writes to the table with no problem but when it does so it is creating another entry with zero content. This is the save steps with open new form

Code:
Private Sub SaveRecordAddNew_Click()
Call PreSaveCheck
If Me.saveCheck = False Then
Exit Sub
Else
Call WriteToTable

[Code] .....

View 12 Replies View Related

Reports :: Inserting Blank Lines To Access Report

Jul 27, 2013

I have a specific form, paper version, that I'd like to reproduce in an Access report. This form, which has 34 blank lines in the paper version, is used when people need to borrow some Tools or Equipment on a short period of time.

My report is made up in Access, but, if a person signs for, lets say, three different piece of Equipment, once it is sent to the printer, it prints three lines, which are the equipement signed for and it leave a big empty space before it reach the page footer.

What I need is something that will fill that empty space with blank lines. I found the following on the Net which meets my needs up to a point. What I mean is once it print the last line, it keeps on printing the last line until it meets the total count of 34 lines.

Here what I found on the Net: (note that I have a =count(*) into the Group Header)

Option Compare Database 'Use database order for string comparisons
Option Explicit
Global TotCount As Integer
' Call the SetCount() function from the group header section's
' OnPrint property using the syntax: =SetCount(Report)

[Code] ....

I submitted an attach file (blank_lines.gif) to show you what I end up with.

View 3 Replies View Related

Reports :: Adding Specific Number Of Blank Lines Between Records

Jun 20, 2013

I have a WO Table and a related WO Procedures Table. I would like to add a specific # of blank lines/records between each record but that # will vary. So the report will show the WO Procedure Desc then a specified # of blank lines below it and then the next WO Procedures Desc then a specified # of blank lines below it etc.

I thought to add a field to the Proc tbl called #ofLines and whatever number was entered would be the # of blank lines to appear below the record on the report.

View 3 Replies View Related

Eliminate Blank Line In Address

Apr 28, 2008

[Solved] I have a report that is based a query formed from 2 tables. The query pulls the address from one table for a client from the other table. This address then appears on the report. There are 6 lines for the address: Company Name, Contact Person, Person's Title, Address 1, Address 2, City/State/Zip. I have this working fine, until an address is shown where there is no Title, or Address 2. Then a blank line is shown. Any suggestions on how I can eliminate the blank line if there is no information to show?

View 1 Replies View Related

Queries :: Date Range Query - Return Lines Where Field Is Blank In Table

Aug 15, 2013

I have a single table with customer information, one of the fields is a date field "LastContacted".

I'm creating a search form with 2 date fields (txtDate1 & txtDate2) to search a date range of the LastContacted field, and I need to write this into the query that the search form uses.

I have written this using Nz so that it can still return results if the search boxes are left blank:

Between Nz([Forms]![frm_AdvancedSearch]![txtDate1],#01/01/1989#) And Nz([Forms]![frm_AdvancedSearch]![txtDate2],#01/01/2999#)

This seems to work and it returns lines from the table where there is a date entered. However some of the fields in the table have no entry in the LastContacted field. How to code this query so that it also returns lines where the LastContacted field is blank in the table?

I have tried:

like "*" & (Between Nz([Forms]![frm_AdvancedSearch]![txtDate1],#01/01/1989#) And Nz([Forms]![frm_AdvancedSearch]![txtDate2],#01/01/2999#)) & "*"

but this returns errors when I try to run it.

I'm using Access 2010.

View 14 Replies View Related

Reports :: Shrink Blank Address Fields When There Is Other Data?

Mar 21, 2013

I designed and used an Access 2003 for some time but I have recently updated to Access 2013 and want to rejig and improve my database. My query is that I need to print invoices from my database, there is a header section with my details, then a section with the customers name and address at the left hand side, and the invoice details such as invoice number, invoice date, PO number, credit terms, etc. at the right hand side. I would like to remove any blank lines from the customers address but to still have the invoice details at the right formatted and spaced correctly. Is there any way of doing this, the canshrink property will not work due to the invoice details which still need to be printed to the right?

View 3 Replies View Related

General :: Replace Input Email Address With Mailto Address

Sep 17, 2012

I have a form where the user puts in a email address, eg test @ myserver.net

So the link opens a new mail it has to be prefixed by mailto:

How can I automatically replace the address the user enters with the format mailto:test@myserver.net

View 3 Replies View Related

Query How To Show A Temp Address Over A Perm Address

Jun 19, 2007

Hope you can help!

I have an access table which lists a customers address, however, if the customer has a temporary address it will also list that on a separate line -

CustID Address Type
1234 5 The Street P
1234 12 The Street T
2345 13 The Road P
3456 12 The Avenue P

Where P = Permanent and T = Temporary

I want to set up a query to show the permanent address where there is only one address, but where the customer has a temporary address also, I want to list the temporary one instead.

Thanks

View 1 Replies View Related

MailMerge Problems - Help Need

Jun 4, 2005

I have started having problems with MailMerge in my database - it has worked before but now I get this error:

Runtime error 5922

"Word was unable to open data source"

Here is my code:


Function MailMerge(strMMTemplate As String)
Dim objWord As Word.Application
Dim objDoc As Word.Document

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(fldMailmerge & strMMTemplate)

'Make Word visible.
objWord.Application.Visible = True
'Set the mail merge data source
objDoc.MailMerge.OpenDataSource Name:="C:cmoscmos.mdb", LinkToSource:=True, Connection:="TABLE tblMailMerge_Temp_Full", SQLStatement:="SELECT * FROM tblMailMerge_Temp_Full"
'Execute the mail merge.
objDoc.MailMerge.Execute
objDoc.Close

Set objWord = Nothing
Set objDoc = Nothing
End Function

I have searched high an low through the forum and web - but no luck.

Any ideas? I am running Access 2003.

Cheers

Will

View 4 Replies View Related

Access Mailmerge

Mar 2, 2006

Hi
Can anyone help?

I am trying to perform a mail merge from Access database table and using Word letter setup with all the necessary variables.
I am using VBA in access to perform this task.
All works ok to the point but the first snag I had when
the Access was not open in Read-Only mode and where
'OpenDataSource' statement was refusing to merge the database to the letter
I managed to overcome this by opening Access in Read-Only mode.

However I hit the second snag.

When running 'OpenDataSource' statement the pop up box comes with option to select a table I want to make connection too.

The table is listed in the within the parameters for the statement, so it does not make sense why is this question.


This is my code:-

Dim WordApp As Word.Application
Set WordApp = CreateObject("Word.Application")
MergePATH = Application.CurrentProject.Path & ""
With WordApp
.DisplayAlerts = wdAlertsNone
.Visible = False
.Documents.Open (MergePATH & "MTSheet3.DOC")
With WordApp.ActiveDocument.MailMerge

.OpenDataSource _
Name:=MergePATH & "io.mdb", _
LinkToSource:=True, AddToRecentFiles:=False, _
Connection:="TABLE tmpTable"

.Destination = wdSendToNewDocument
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute
End With
.ActiveDocument.SaveAs (MergePATH & "Dummy.doc")
.ActiveDocument.Saved = True
.ActiveDocument.Close
.Quit
End With

Set WordApp = Nothing



Can anyone explain what the problem ?

Thanks
The is holding up progress of a big project

View 3 Replies View Related

Mailmerge And Security

Dec 22, 2006

I am using Access 2003 and have secured my database, so that it now consists of an .mdb and an .mdw file. The .mdb is opened using the security settings in .mdw using a shortcut.

I want to set up a mail merge into Word 2003, but whenever I try selecting my database as the source of the data I want to merge, it won't let me log in.

Can anyone advise me how I can get this to work correctly?

Thanks,

Gary

View 3 Replies View Related

Handpick Records For Mailmerge

May 21, 2005

Hi,

the problem i have is this -

i have a stores database for all items in a warehouse. i need to be able to have a button on my form that sends the current record to a word template to be printed out on labels. i need to be able to specify the amount of labels for each record, and i need to be able to send multiple records to the same template. i have absolutely no idea how to do this.

ive got the template set up, but currently it is mailmerged the normal way, meaning it would just print every record in the DB on the labels. i was thinking of having some kind of check box in the DB so that the user can use the form to find all the records they want to print, check the box for each (and also enter a number for the amount of times they want that record printing on the sheet) and then have a button to send the final document to the printer. this brings up another issue - how do i empty the check box for every record each time the form is used so that all the previously printed records do not get reprinted?

If anyone has got any idea how to overcome any of these problems i would be extremely grateful.

Thanks

View 1 Replies View Related

Mailmerge Email With Attachment

May 21, 2012

In my database which is used by a charity I have a button which opens a mailmerge email document in MS Word using the following Visual Basic code -

FollowHyperlink "C:Our FoldersBWMCJuly Donors Email.docx", , True, True

This mailmerge document draws its personal information from a query in my database. And sends off personal emails to a number of donors.

I want to attach a personal document called 'Allocations.docx' which is also a mailmerge document drawing its personal information from the same query. How can I automate the attachment of this document to the email so that each donor gets their own email plus their own attachment?

Can something be added to the existing line of VB which will do what I want? If so, what do I need to add?

View 8 Replies View Related

Email Address, Web Address, Hyperlinks, Etc..

Aug 9, 2006

I have a form bound to a table which stores contact info for a person. I have two controls that are email_address and website_address. I set them both as hyperlinks.
So now when the user clicks on the email_address Outlook opens a new message with an email_address in the To field. (I had to use a function found on this forum to replace the "htttp" with "mailto" on AfterUpdate event in order for this to work properly.) However, now trying to add some other features to my DB I ran into problems listed below. I wonder if I should have rather left that control as Text instead of Hyperlink, and use the DoCmd.SendObject on doubleclick event instead of using the above solution.
How people usually store email addresses and enable emailing on click?

The problems I ran into:
1) My main form is in popup mode and therefore right click on the hyperlink does not give an option to edit the hyperlink
2) I copied a function from this forum which gathers a list of emails and sends one message to the emaillist. However, my email list instead of generating as:
email1@a.com; email2@b.com
it generates as:
email1@a.com#mailto:email1@a.com#; email2@b.com#email2@b.com#

I guess I could extract the email using vba (not sure how), but I still don't know how to solve issue number 1. So maybe it is better to siwtch the field to plain text and forget the hyperlinks?

Thanks,
Mariusz

PS. What procedure on double click would open a default browser, since I also have to deal with web addresses and thought of turning them into text controls?

View 1 Replies View Related

MS Word Mailmerge Window Is Autominimizing

Jul 28, 2005

I just started having an issue with a mailmerge launching form in Access. A button I've set up, called "Order Form," uses the following code to launch Word, merge the data into the document, save the document, and close out the template. It's a large sample, and I think it may have come from this website at some point last year:

<---------START--------->

Private Sub OrderForm_Click()
'creates an SQL statement to be used in a query def
'On Error GoTo ErrorHandler

Dim val As String
Dim db As Database
Dim rec As DAO.Recordset
Dim strSQL As String
Dim strDocumentName As String 'name of the template document

Set db = CurrentDb
Set rec = db.OpenRecordset("SELECT Order_ID FROM tmpCurrentTGOrderID;")

While Not rec.EOF
val = rec("Order_ID")
rec.MoveNext
Wend

rec.Close

'Select all records from the record table were the table's Order_ID field matches
'that of the temporary table's.
'qry = "SELECT TG_Orders.Order_ID, TG_Orders.Order_Date, TG_Orders.Order_HonoredPerson, TG_Orders.Order_TreeGiver, TG_Orders.Order_PlantingState, TG_Orders.Order_Product, TG_Orders.Order_Type, TG_Orders.Order_Line1, TG_Orders.Order_Line2, TG_Orders.Order_Card, TG_Orders.Order_Occasion, TG_Orders.Order_First, TG_Orders.Order_Middle, TG_Orders.Order_Last, TG_Orders.Order_Have, TG_Orders.Order_Digits, TG_Orders.Order_CardType, TG_Orders.Order_Comments, TG_Orders.Order_Donate, TG_Customers.*, TG_Shipping.* FROM (TG_Customers INNER JOIN TG_Orders ON TG_Customers.Customer_ID = TG_Orders.Customer_ID) INNER JOIN TG_Shipping ON TG_Orders.Order_ID = TG_Shipping.Order_ID;"

strDocumentName = "TG_OrderForm.doc"

strSQL = "SELECT TG_Orders.Order_ID, TG_Orders.Order_Date, TG_Orders.Order_Confirmation, TG_Orders.Order_HonoredPerson, TG_Orders.Order_TreeGiver, TG_Orders.Order_PlantingState, TG_Orders.Order_Product, TG_Orders.Order_Type, TG_Orders.Order_Line1, TG_Orders.Order_Line2, TG_Orders.Order_Card, TG_Orders.Order_Occasion, TG_Orders.Order_First, TG_Orders.Order_Middle, TG_Orders.Order_Last, TG_Orders.Order_Have, TG_Orders.Order_Digits, TG_Orders.Order_CardType, TG_Orders.Order_Comments, TG_Orders.Order_Donate, TG_Customers.*, TG_Shipping.*, TG_Orders.Order_Cost, TG_Orders.Order_Remembrance "
strSQL = strSQL + "FROM (TG_Customers INNER JOIN TG_Orders ON TG_Customers.Customer_ID=TG_Orders.Customer_ID) INNER JOIN TG_Shipping ON TG_Orders.Order_ID=TG_Shipping.Order_ID "
strSQL = strSQL + "WHERE TG_Orders.Order_ID=" + val

Call SetQuery("TG_OrderFormQuery", strSQL)
Dim strNewName As String 'name to save merged document as
strNewName = "Order " & Format(CStr(Date), "MMM dd yyyy")
Call OpenMergedDoc(strDocumentName, strSQL, strNewName)

Exit Sub
ErrorHandler:
MsgBox "Error #" & Err.Number & " occurred. " & Err.Description, vbOKOnly, "Error"
Exit Sub

End Sub

Private Sub SetQuery(strQueryName As String, strSQL As String)
On Error GoTo ErrorHandler
'set the query from which the merge document will pull its info
Dim qdfNewQueryDef As QueryDef
Set qdfNewQueryDef = CurrentDb.QueryDefs(strQueryName)
qdfNewQueryDef.SQL = strSQL
qdfNewQueryDef.Close
RefreshDatabaseWindow
Exit Sub
ErrorHandler:
MsgBox "Error #" & Err.Number & " occurred. " & Err.Description, vbOKOnly, "Error"
Exit Sub
End Sub

Private Sub OpenMergedDoc(strDocName As String, strSQL As String, strReportType As String)
On Error GoTo WordError
'opens an instance of word, opens a merge template which has its data source
'already linked to a query in this database, merges the template,
'saves the merged file with a descriptive name, then closes the merge template

'Set the directory for any labels generated
Const strDir As String = "D:LOA-DataMerge Templates"
Dim objWord As New Word.Application
Dim objDoc As Word.Document
objWord.Application.Visible = True
Set objDoc = objWord.Documents.Open(strDir & strDocName)
' Make Word visible so that if any errors occur, you can close the instance of Word manually
objWord.Application.Visible = True
'merge to a new document
'if you are not sure of the SQLStatement to use in your OpenDataSource string, uncomment the following four lines to have the 'current SQLstatement print in the immediate window. You can then copy the returned string to your code
'Debug.Print objWord.Application.ActiveDocument.MailMerge.DataS ource.QueryString
'objWord.Quit
'Set objWord = Nothing
'Exit Sub

objDoc.MailMerge.OpenDataSource _
name:="D:LOA-DataLOAv817.mdb", _
LinkToSource:=True, AddToRecentFiles:=False, _
Connection:="QUERY TG_OrderFormQuery", _
SQLStatement:="SELECT * FROM `TG_OrderFormQuery`"
'notice that this is not the SQL statement that makes up the QueryDef of the query. It
'is the SQL statement that tells Word whether to use all the records returned by the
'Query. Notice also the funky single quotes – this is what DataSource.QueryString returned
'to me in the immediate window. I’ve also seen the query name written in 'brackets [ ],
'but have never tested this code with them.

objDoc.MailMerge.Destination = wdSendToNewDocument
objDoc.MailMerge.Execute
'save the merged document with a descriptive name
'you can delete this line if you want to leave the document with the default name “Labels 1” or “Letters 1”
objWord.Application.Documents(1).SaveAs (strDir & "" & strReportType & ".doc")
'close the merge template
objWord.Application.Documents(2).Close wdDoNotSaveChanges
'release the variables
Set objWord = Nothing
Set objDoc = Nothing

Exit Sub
WordError:
MsgBox "Err #" & Err.Number & " occurred." & Err.Description, vbOKOnly, "Word Error"
objWord.Quit
End Sub

<---------END--------->

Just today, this code started auto-minimizing the MS Word window, causing user error (after the documents been minimized, instead of clicking on the task bar, the user would click the button again, prompting that the document is already in use, would you like to save changes before closing the document, etc). Is there anything in this code that is telling Word to minimize? It's only happening on this one button, and there are 7 other mailmerge buttons on the same form, using the same code, that work fine.

Any help would be greatly appreciated,
Nate

View 1 Replies View Related

Security Password - Access To Word Mailmerge

Apr 4, 2007

Dear Guru,

I have an issue which having read some previous threads may not be resolved simply. My database is password protected.

The password (presumably) is preventing the mailmerge from connecting the deata with the template. There is not even a password request shown. Is there any way that this can be overcome. There are a number of mailmerges but all are pulled from the same data query, can i unprotect this query only??

After convincing my boss that the dbase can easily run securely, your help will be very much appreciated.

Yours
Andrew - In sunny Hull, UK.

View 2 Replies View Related

Modules & VBA :: Access Mailmerge To Word Including Image

Nov 25, 2014

I have a database of film events, for which i have to do posters.

With the click of a button on a form, access opens word and puts all the fields in, including a field called [photo], which is the name of the image stored outside of the database.

Is there a way of getting that image into the word Document with all the other fields? Or have I just wasted an afternoon....

View 2 Replies View Related

Modules & VBA :: Mailmerge Current Record And Save As New Document

May 25, 2014

I'm looking to add a button to my Customers form which will mailmerge the current record to a Word template and then save the Word doc as a new file (Ideally the customer's name).

I've looked at the Super Easy Mailmerge but I can't work out how to implement it without all of the variables (selecting documents etc.).

The files will all be saved to one location (C:CustomersExports) and this won't change.

This is also the location of the mailmerge template (C:CustomersExportsTemplate.docx)

View 9 Replies View Related

Modules & VBA :: Automating Mailmerge From Access Form To Word Document

Aug 5, 2013

I am having the strangest results with my automated mailmerge. Basically it does work, but not all the time. The basic idea is to allow the user to dynamically create a query that produces a result list which fills a temporary table. The use then selects a prebuilt merge template and merge is executed against the temp table. The merge template are of the .doc type, but sme have been converted to .docx; the .doc files tend to work most often, but all of the will eventually get a Table is locked message... However if I run in test mode with code breaks and manually step through the process it always works... here is the heart of the code ...

Err_Pos = 10

Code:
DoCmd.SetWarnings False
' if tmp tbl left over from last run kill it
DoCmd.RunSQL "Drop table Word_Merge_Tmp_TBL"
Err_Pos = 12

[Code].....

There are many error cases in the error catch routine. That I have managed to make Access stop hanging when word has a problem or the table is locked. But I can't get the table to be free consistantly and why does it always work when I manually step through the code.

View 4 Replies View Related

Queries :: Pulling Records Based On Blank / Non-blank Criteria

Jul 18, 2013

I have a couple different reference files that get updated each week. Sometimes there are missing data elements, so I'd like to structure a select query to show me those records that have blank elements but I'd like the similar records to be pulled in as well, so I can make a determination as to how to populate the blank records..

See attached example: I have a client ID reference table that gets populated with forecast owner names (individuals responsible for the customer) from a couple of different sources. Sometimes there are names attached and sometimes the field is blank.

How can I structure a query to show me just those Client ID's that have multiple entries with blank AND non-blank forecast owners? I'd also like to exclude single/multiple records where there are only blank records...

View 3 Replies View Related

Query Criteria With Blank And Non-blank Text Records

Mar 13, 2007

OK, I have been searching around on the fourm for over an hour now...I give up. If this is some where else, I am sorry.

I have a database of maintenance data. There are several columns that are usually filled in, some records have some columns blank. They are formated text because they hold letters and numbers (see pic).

I am using a form to query the table...no problem. The form has text boxes the user filter down the data

The problem comes are with the results of the query. Any record that has a blank column is not retuned. I am using "Like" so that the user can enter in partial codes. I know "like" won't return "null" records.... Help!

Things I have tried:
1)IIF(form field is blank, return table field, else use like command to filter) - returns nothing!
2)Like "*" & [Forms]![Fleetwide_data_Request]![MAL_CD] & "*" returns all records without blanks (i.e. missing data)

what else can I do?


Thanks

View 5 Replies View Related

Blank New Form Is No Longer Blank?

Apr 11, 2006

Hi guys,

I have been running the same database on numerous systems for 5 years and the user clicks on a button and using this code;

DoCmd.OpenForm "Employee", acNormal

Simple !, this always opened this form blank, without applying filters, ready to accept a new employees details.

But now this no longer works, for no apparent reason?
What happens is that it opens with the form fields filled with the first person in the Databases details instead of being blank.

The only thing that could have changed is that i converted the database to 2003?

Any ideas?

Thank you in advance

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved