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 7494 articles. 0 followers. Follow

0 Replies
1202 Views

Similar Articles

[PageSpeed] 32

Reply:

Similar Artilces:

Login with pwd & Open the main form depends on pwd
We have three groups of user that will use our database. Administrator (my boss & me), PowerUser (Manager / Supervisor) & NormalUser (clerk) Now, my front-end .accde will open my designed form – (main menu1) without any control. What we are planning are : 1. Users should have input their password (user can change by themselves) before they can login into the main menu. 2. Different class of user can open their own menu only (eg. Poweruser will open Frm_MainMenu1 & NormalUser will open Frm_MainMenu2 …) that depend on what password they input Could you give...

How do I print a list of the directory contents
I need to print the disk directory contents. In DOS this was possible. Is it possible in WORD? Thanks No - but you could use the freeware Printfolders utility you can download from my web site that will produce a text listing that you can open in Word. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <...

Amount in Words/System Manager ISV
Hello: During the installation of GP 10.0 and the section where module selections are made, there is a module called "Amount in Words". What is this? Also, in someone's reg keys, I noticed a module called "System Manager ISV". What is this? Thanks! childofthe1980s ...

printing copies
under print options: Number of copies___. It will only print out 1 copy. I say 5 and it still prints out 1. I am a new user of 2007 Excel I suspect the problem is with the printer. Try getting the newest driver best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "Val in Texas" <Val in Texas@discussions.microsoft.com> wrote in message news:78A83505-189A-4731-AF25-CD5505E33510@microsoft.com... > under print options: Number of copies___. It will only print out 1 copy. > I > say 5 and it still prints out 1. ...

Ghosted print and print preview
Hello everyone, I have a problem with printing in excel. The print and print preview options appear ghosted. I still can print through the print icon on the toolbar. Any suggestions??? Martin ...

Word 2007 Configuration at start up
Word opens very slowly because it performs a configuration process every time it starts? I should mention that Exel opens fine as well as other Office 2007 program. Also I did have Word 2000 installed but took it off already and also un installed the trial version that was on here. So those fixes have been tried already. "miatapete" wrote: > Word opens very slowly because it performs a configuration process every time > it starts? Run Word as administrator and allow it to reconfigure. If you have more than one Word version installed - see the registry chan...

code wild card value for form variable
i use a check box in an option group to generate a specific value for a variable. using the following code If Forms![fee sched form]![select region] = 2 Then Forms![fee sched form]![region var] = "Roch" End If If Forms![fee sched form]![select region] = 3 Then Forms![fee sched form]![region var] = "CNY" End If this variable is hidden on the form and value is used a query. how do i code this, so i can put "*" in the variable and thereby get all values in the query? the query code generates like "*" but i do not know how to code via the fo...

Simple date on form
Hi. I need to show the current date in a text box on a form, allow tha date to be edited if need be by the user, then when the user clicks th save button, save the edited (or if not edited, current date) to th worksheet. I also don't want the date to read mm/dd/yy. I would lik it to read dd/mm/yy. I'm pretty sure I know how to save to the worksheet, but I thought had better mention it, as there may be some little trick to it!. Can anyone help me please -- Message posted from http://www.ExcelForum.com Do you need it to be on a form? using an input box would be easier, somethi...

Print Dynamic Range
I have a basic excel template used for ordering parts. It runs from A1:N250 and I can print easily repeating rows 1:11 on each page (contains job details) . Trouble is sometimes there may only be 10 part numbers requiring only first page and I finish up throwing away trees by printing entire sheet! I know I can reset print area each time am setting this up on Sharepoint for multi users and need a macro/button to recognise number of items and print accordingly. Any help greatly appreciated -- Message posted via http://www.officekb.com Sub SetPrintArea() 'change this cons...

re: can't open corrupted word doc? encoding garbage?
Hey Mac Geniuses, I fix mac computers too, so I'd love your take & expert advice on my friend's computer w/ these two issues. Searched forums & google with varying degrees much luck. I DID find this post from google groups: http://groups.google.com/group/microsoft.public.mac.office.word/browse_thread/thread/d9a81587a602f5ba/1e19331b62dc937c?lnk=gst&q=corrupted+#1e19331b62dc937c Thanks in advance for your help!!! Definitely much appreciated! Here are the two main issues: 1. Corrupted word for mac issues She cannot open these files. It also seems to be &quo...

TCP/IP printing
Hello, I have a networking question. I have a print device with a static IP address on one network. A computer on another network can connect to the printer (NBT is enabled and so is LPR) and the drivers are installed but cannot print. I know this is correct behavior but want to know in detail why it seems to half work. I am guessing it has to do with port 138,139 and 515 but not positive. Probably a better question to ask a networking forum but hey. Thanks can you access the printer through the printer IP address? -- ashvin :D Just chill -pls post your feedback on...

Printing booklet
I am producing a 50 to 60 page booklet using Pubisher 2003. The page format will be using 8.5 x 11 paper folded in half. I need to print both sides of the paper. How do I print the booklet so that I print half the project on one side of the paper and the other half on the back. Will publisher keep track of the pages so that for example; that page 2 and page 50 print on the same side/sheet of paper so when all pages are printed, folded and bound the book reads correctly. Thanks John Houston, Tx more info...I am using a single side printer so I have to run the pages through twice ...

Excel data into Word
I need to layout some data from excel into word. The final product needs to have 5 columns so that it looks like (repeated across). Name Name Address Address City, State ZIP City, State ZIP I remember doing this years ago in Word, but I cannot figure out to do it. I need to end up with 127 entries. This is for a page in a document. I seem to recall that at the end of each merged entry, there was a code that told word to enter the data going across rather than making a new page. Depending on whether you want the ent...

Check printing in GP 7.0
Dear Guys, I have check payments for vendors, where I'm dealing with LOCAL CURRENCY & FORIGHN CURRENCY. When I paid by check in LOCAL CURRENCY then the amount in words prints perfectly but if i paid by check in FORIGN CURRENCY then the amount in word prints in numeric which i want to print amount in words instead of numbers. Please help me to print checks amount in words for FORIGN CURRENCY as well. Your suggestion would be appricated on above issue thnx Shamin ...

Cannot protect form
I have a form that I have created. I am ready to protect it, but "Yes, start enforcing protection" is greyed out. What might be wrong? Thanks! Sorry, accitentally posted in wrong area. "Kila" wrote: > I have a form that I have created. I am ready to protect it, but "Yes, start > enforcing protection" is greyed out. What might be wrong? Thanks! Could you clarify what you're doing? Outlook has no command like that. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Admini...

Need advice on Single Doc, Multi View framework
Hi guys, I'm about to start on a quoting application. What I want is for only one quote (document) to be open at a time. However a quote can have one or more items belonging to it. So what I'd like to do is have a CDialogBar docked at the side of my app's main window which contains the details about the quote (date, client, etc) and for each quote item I'd have a CFormView (a must as I require scrolling support). The application must also have print/print preview support (Not of what is in the CFormViews but of the document as a whole which doesn't have a view). So basical...

Excel BUG (All Versions) Excel Macro Margins using Print Preview
Where can i post this BUG? (Excel Macro Margins using Print Preview) Is there an Excel BUG reporting site? Steps: 1) New worksheet, write something in it 2) Start recording a new macro 3) File -> Print Preview 4) Click on the Margins Button, the page margins will appear, so that you can visually change and move them 5) Set one or more margins 6) Close the Print Preview 7) Stop the Macro What happened is that in the VBA code there will be writtenthe following lines: ..LeftMargin = Application.InchesToPoints(0.91) ..RightMargin = Application.InchesToPoints() Where in second line ther...

"Tiled" print setting.
I just want the page that I designed to print on one page! I can't change the print setting "tiled" and as it is, it's printing on four pages all broken up. It is possible that you have created your document on a paper size that is not supported by your printer. Try changing your paper size to 8 1/2 by 11 and see if the print options are more to your liking. "MissMarple" <MissMarple@discussions.microsoft.com> wrote in message news:A6776BEA-37EE-4645-B389-866A6CDB2D96@microsoft.com... >I just want the page that I designed to print on one ...

CHtmlView and Printing
Hi Everyone, The CHtmlView is giving me alot of head aches. Here is what I am doing. I am opening an XML file (being formatted using XLST) in a hidden CHtmlView and printing it. Here is how the process goes: 1. I create the XML file on the fly. 2. load the XML file in to CHtmlView. 3. Once loaded I tell it to print the resulting HTML page. 4, I need to delete XML file after the printing is done. (this is the problem). I can't figure out how to find out when the CHtmlView is done printing. CHtmlView::OnFilePrint is asynchronous. And CHtmlView doesn't tell me that it is currently p...

Problems with printing
Dear all I have an application, which has been working without problems for the last 7 years. The application has some printing capabilities. Now, we have just gotten a new printer (HP Laserjet CM4370), and when I try to print, my application crashes. The app crashes in the print setup dialog even before I press OK. If I select any other printer as default printer, the app doesn't crash. Then I can show the print setup dialog without problems. But then, when I select the CM4370, the app crashes again, even if I do not press OK. Even if I choose to not show the print setup dialog, and j...

How do I center word art exactly on the page in Publisher 2003?
Use the Arrange > Align/Distribute buttons. You can tear off the sub-menu to create a toolbar if that makes life easier for you. Then use the Relative to Page option to say to center the object relative to the page, and the Center buttons to centre it. -- Ed Bennett - MVP Microsoft Publisher http://ed.mvps.org ...

Word is deleting spaces between words and sentences
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I am a writer and editor who works on large Word files (200 - 300 pages). I just sent a 300-page manuscript to a colleague and all of the spaces between words and sentences were removed when she opened the file on her PC! My file looks fine but when she sent me the file she had opened, all the spaces were gone. This is a disaster for me if i can't find a fix. Anyone know how to fix? <br> Thanks! One of you is missing some important updates. Make sure your copy of Word is fully up-to-date, and that hers...

Saving a Customized Form Times Out
When we try to customize a form and save it, it hangs for awhile, then we get a "this page can not be displayed" error. However, it appears that the customizations made to the form still get saved. It only happens when we try to save changes to a form. Has anyone had this problem before? Any information will be extremely appreciated! Thanks, Dusty ...

data from sql to pdf form
how can i merge data like customer name, address, etc. from sql to a pdf form? thank sam Idea #1 Sql Server Reporting Services. PDF is one export option. You should supply which version(s) of Sql Server you have.............the more information you provide, the more exact any tips can be. "Sam" <focus10@zahav.net.il> wrote in message news:uUqHHPLhKHA.5424@TK2MSFTNGP02.phx.gbl... > how can i merge data like customer name, address, etc. from sql to a pdf > form? > > thank > sam > > sql server 2000 &quo...

Printing--How not to Print Bkground
In my wrksht there is a cell range highlighted with an autofill color. We use this to show the user where to enter the data. Is there anyway to avoid printing this background color. We want to keep the color in the cell range in our wrksht but we dont want it printed. Hi Jeff, have you tried Print preview, Setup, Sheet, Black & white? Gilles "Jeff" <anonymous@discussions.microsoft.com> wrote in message news:001201c3ba81$023b8af0$a301280a@phx.gbl... > In my wrksht there is a cell range highlighted with an > autofill color. We use this to show the user where t...