Printing WORD docs from a form

I have a button on a form and I want it to print a Word mail merge document
that contains data from the database that is linked to my application.

 I'm using the following code but always get a  5922 error - Word can't
 open the source... All variable names contain valid data, so that's NOT
 the problem.

        With appWord
        .Visible = True
        .Documents.Open pathdocname
            With .ActiveDocument.MailMerge

                .MainDocumentType = wdFormLetters
                strConnection = "DSN=MS Access Databases;" _
                    & "DBQ=" & strFileName _
                    & "FIL=RedISAM;"
                .OpenDataSource Name:=strFileName, LinkToSource:=True, 
ReadOnly:=True, _
                    Connection:=strConnection, _
                    SQLStatement:="SELECT * FROM People WHERE !ContactID = 
People.ContactID"
            End With


Even if I take out the WHERE clause, it doesn't work. It just won't
 connect.

 WHAT AM I DOING WRONG???

 Thanks folks...


0
Greg
5/16/2007 1:12:12 AM
access.formscoding 7493 articles. 0 followers. Follow

0 Replies
2291 Views

Similar Articles

[PageSpeed] 41

Reply:

Similar Artilces:

OOM PrintOut fails, but printing from OL ok??
I have a PST with a meeting item. I have a multi-step process where I print the item while scanning the PST and then save the item as a MSG file. In another step I print that same item but from the MSG file. In this step I am calling CreateItemFromTemplate passing the path to the MSG file then PrintOut. On this call to PrintOut and exception is thrown. The description is Can't open Calendar folder for User <username> The item could not be found. The username is not the owner of the PST. What is the difference printing from the item imported from the MSG and printing from...

How do you select a specific Visio tab when 'Inserting Object' into Word doc?
I am inserting an object (Visio diagram) in my Word document so that updates to the Visio diagram are automatically reflected in the Word doc. I clicked Insert > Object > Link to File, and used it as a workaround to the bug found when you copy the Visio diagram by clicking Edit > Paste Special > Paste Link (bug is found if the Visio diagram is on a file share; you can't insert it - the option for Paste Link is grayed out). This Insert > Object workaround works fine, HOWEVER, my Visio file has multiple tabs on it. How do I distinguish which tab I want to embed? ...

Form problems in a table with merged cells
I have a spreadsheet I've been using for several years in which I had set up a ribbon button to show a data entry form using the table headers. I merged some cells in an area adjacent to the table and the form would no longer work. Clicking the ribbon button simply gave the message that the command could not be used in a table or range containing merged cells. I unmerged the offending cells but it still doesn't work. I'm stumped - can anyone please help> -- John ...

Overriding constraint restriction message, when deleting record(s) from form
This posting follows my post "Overriding constraint restriction message" from 21.04.2010 12:00. Overriding constraint restriction message when changing a record, or when adding a new record, now works - thanks link (http://support.microsoft.com/default.aspx?scid=kb;en-us;206175) provided by Stefan. But solution provided there didn't help when records were deleted (My forms are continous, so there may be several records selected for deleting, and some of them may be allowed to delete, and some not). I tried to write for this case a function similar to the one pr...

C or C++ Utility for wrting .doc format
dear all, my final output is to write MS Word .doc file my input is some text and Images . and i have to write using either c or c++ , can you tell me any third party Libs or is there any API provided by Windows or MSVC or .... if there is nothing and i have understand the complete file format and write it as binary file then please help me how can i get the format details and i have Image decoder all ready developed .... so there is no problem of decoding the images Regards, Karunesh >karunesh" <karunesh.ind@gmail.com> wrote in message > me how can i get the format deta...

XML not opening in Word 2003 when requested from IE 6
I built a web app that creates and saves a WordML file on disk (with a processing instruction in it for Word.Document). When this file is requested from a client machines, the client's browser automatically opens Word 2003 and views the XML in the Word application as a document, as its supposed to. However, on one machine, the XML text just opens in the IE window as straight XML text, totally ignoring the PI to treat as a Word document. Checked all the File Types for XML and DOC and they are the same one this machine as the others for the "open" and "edit" ent...

Form Numbers Automatically Increment by 1 Upon Opening
I need to have the form number on the form increment by 1 when the form is opened by another user on the system. I'd like to know how to do this also if anyone would care to share their knowledge. I assume it would take VBA. -- pdgood ------------------------------------------------------------------------ pdgood's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=31623 View this thread: http://www.excelforum.com/showthread.php?threadid=538181 Have a look at John McGimpsey's VBA method. http://www.mcgimpsey.com/excel/sequentialnums.html Gord Dibben...

List boxes in excel forms
Can someone please tell me how to enter values in an excel drop down list box? I am not an advanced user and am really struggling! Thanks Hi Liz! Two ways: Select the cell where you want the list box to be Data > Validation > Allow Select List Type in the list separated by commas. Type in your list in a range of cells Select the cell where you want the list box to be Data > Validation > List Type in the reference to your range of cells. If the range is not on the same sheet, you need to name it and refer to it by name. -- Regards Norman Harker MVP (Excel) Sydney, Austral...

integrate web page form with sql and crm
Is it possible to edit the "case" form using front Page. If so how do i set it up to access the sql database. These forms are not designed to be edited in frontpage. "Dana" <anonymous@discussions.microsoft.com> wrote in message news:e28701c3f0e5$21e37e40$a101280a@phx.gbl... > Is it possible to edit the "case" form using front Page. > If so how do i set it up to access the sql database. ...

Form On Open event, except not exactly
I have a form with a command button that opens a second form and populates it with data from the initial form. That part is fine. What I want to do is use that data in an On Open event (or something) that will execute *after* the data is loaded by the first procedure. Specifically, the second form should display an image based on a path and filename concatenated from the first form's data : Forms!PhotoData!imgFrame1.Picture = strImagePath It all works fine using a command button on the second form; but that requires loading a default image and a manual click to display the intended imag...

Pub 2007
On one computer, when you open a previously created .pub file, some of the pictures are blurred / fuzzy. They print out clearly. This has just started happening. No major changes in software installations etc. Previously they were all just fine. This is a reasonably new computer. If you take the files to another computer, they display properly and print properly. I have uninstalled and reinstalled Publisher 2007. No change. I spent an hour on phone with Publisher support and they seemed to think it was printer related. I have uninstalled the printer and installed a different bra...

Problem printing inserted images
I've been having a strange printing problem lately, when I insert images in my files some of them print out as solid black rectangles. The strange thing is that up to about a week ago I was able to print out the same images just fine, and if I open the images in Microsoft picture and fax viewer they print fine as well (so I know the file isn't corrupt). Does anyone know how to solve this problem? Publisher is more critical about printer drivers than many applications. Go to your printer manufacturer's web site and look around for an updated driver. -- Mary Sauer MS MVP http://o...

get random record in form
I have prepared a online test portal in MS access for 25 users. Users login & they give test. All of them access same question master and receive questions in their respective forms. What i wish to do is i wish that every body gets records in random manner. Idea is every body needs to solve ten questions from the question master but the sequence should be different for all. Can we do it using query or we need to write some macro.. Hope the problem is clear.. Kinldy help.. thanks a lot.. Boss hi, Boss wrote: > What i wish to do is i wish that every body gets records in ran...

Max size of user form?
Can anyone help me with this question? What is the Max File Size a User Form can be? I have Windows 7 with Office 2007. Does it have like a 64K limit? Are referring to the size to mean dimensions (height, width) of the userform, or the size of the modules that contain the code and its controls? Cordially, Chip Pearson Microsoft Most Valuable Professional, Excel, 1998 - 2010 Pearson Software Consulting, LLC www.cpearson.com On Wed, 24 Mar 2010 19:26:01 -0700, Brian <Brian@discussions.microsoft.com> wrote: >Can anyone help me with this question? > ...

Dot Matrix Printing
Using: Windows 2000 Professional - Access 2000 - Okidata Printer ML 395 - 14 7/8 x 11 Green Bar Problem: a) cannot get the printer to print all the way across the green bar paper (there are no 14 7/8 x 11 setting in the "Page Setup") b) printer prints with 2 passes for the same line (it overprints the same characters) c) cannot get the printer to print bi-directional (I want it to print left to right for one line and right to left on the next line History: Went throught the Access Software manual (no help) - Went through the printer manual [Access software should control ...

SOP Blank Report to show in print Picklist
Hi All, I just modified SOP Blank Order Form by adding a Calculation field and Saved it. Now, when I go to Transaction Sale History, open it, and pick one Document Id. It's showing data including of Total amount. However, when I click print and I check Order checkbox but there's no SOP Blank Order Form showing up, it's just showing Blank Form, Short Form, Long Form in dropdown list. So, how can I add SOP Blank Order Form I did modify to show in dropdown list so that when I click Print it'll show all data containing custom calculation field correctly? Please advice ...

2nd ORDER BY in form fields
Hello! In Form, I have a Field1 with ORDER BY and work fine to this field, but I would like to apply 2nd ORDER BY to 2nd field too (Field2). With ORDER BY in Field1, logically, isn't order the Field2. Away the Table is ordered by Column1 Field1 and Column2 Field2. Now, in Form, the order is: Field1 Field2 1 C 1 A 1 B 2 B 2 A 2 C 3 B 3 A 3 C I need: 1 A 1 B 1 C 2 A 2 B 2 C 3 A 3 B 3 C I don't know to obtain this in Form. Therefore, any help is welcome...

Previewing the pages to be printed from a help topic
HI I need help on the above subject.just to know the number of pages to be printed in order not to be out of paper I have window XP professional it does not work either oe EXCEL2002 and/or WORD200 many thanks in advanc fua fuadalazar@hotmail.com Hi the best idea i have is to print to a PDF document (if you have a PDF printer driver installed). Otherwise not possible with build-in functionality) -- Regards Frank Kabel Frankfurt, Germany fuad wrote: > HI! > I need help on the above subject.just to know the number of pages to > be printed in order not to be out of paper. I have windo...

Publisher-Color changes do not show up in Print Preview- Why not?
Hi... I have changed the color of several pictures and fonts on my business cards and logos, but they do not show up when I select "PRINT PREVIEW." How do I get the colors to be the ones that I have selected? I assume you are using Pub 2007. There is a known bug, usually associated with certain HP printers, that causes this. Change your default printer to something else, preview it, then print it with your usual printer. -- JoAnn Paules MVP Microsoft [Publisher] ~~~~~ How to ask a question http://support.microsoft.com/KB/555375 "Rebekka" <Rebekka@discussions.m...

Delete on Continuous form gives error 2046
Hi All, I have hunted the newsgroup and tried many different things, but I still can't seem to get this right... I have a main form for entering in order information, and a sub form for adding in the items ordered. The subform default view is set to 'Continuous Forms', Allow Additions/Deletions/Edits are all true. the data entry property is false if that makes any difference. I have put a button (btnRemoveItem) into the details section of this subform - and have tried to write the code to have the current record deleted when the button is pressed. The code I used that gives th...

how to print cells based on "Yes".
If the first cell in row 1 of Column "A" is "Yes", how do I get preselected contiguous or non contiguous cells in the same row to print? If the answer is "no", I do not want cells in that row to print. Thanks for anyones help! Francis Knight Hi Francis You can use Data>AutoFilter to filter on that column and print. Only the visible cells will print -- Regards Ron de Bruin http://www.rondebruin.nl "Francis Knight" <Francis Knight@discussions.microsoft.com> wrote in message news:43968233-50D0-4038-B31B-3C089DA99A7B@microsoft.com... &...

Excel file into Word
I want to put an Excel icon into a word document (like an attachment in an email), but I can't seem to do it. If I cut and paste the icon into Word, it pastes the contents of the Excel file, not "an attachment", and if I click "insert", "file", it only list's Word files... I have seen this in other documents, I'm sure... -- Rob, Teesside, UK Inside MSWord: Insert|Object|Create from File Tab Browse for your .xls file. Check the display as icon on that dialog box. abfabrob wrote: > > I want to put an Excel icon into a word document (like...

expanding/collapsing subdatasheets in a form?
Hi, all, In a table I can easily get those expanding nodes (+ and - signs) to expand/collapse subdatasheets. How can I get those in forms? Thanks, Sean ...

add ins for word 2007
Hi, I am trying to download some add ins for word 2007, specifically the office math i cant seem to download the redistributed pack, the windows intaller to go with the office math. I need some help with this issue. thanks, Joe. -- JLH -- JLH "Joe-Ho" wrote: > Hi, > > I am trying to download some add ins for word 2007, specifically the microsoft > math i cant seem to download the redistributed pack, the windows intaller to > go with the office math. I need some help with this issue. thanks, Joe. > -- > JLH ...

Help with MS word
Can someone help me with the following: - Adding fields to document properties so that it can be easily retrieved from share point - Populating these document property fields in the document such that when the values in the document property are changed the word document updates itself - Getting images list in the 'Table of contents' page of the document - Getting the external references in the 'Table of contents' of the document - Preparing the template such that when the base template is updated, documents based on this template within the sharepoint are updated ...