Thank You for making such a wonderful video. Does it still work in Access 2019? I am not getting the Bookmarks control when I am trying to assigning field name to bookmarks field.
Hi, Steve! Your videos have helped me in my project immensely, and I truly appreciate them, thank you! I hope this question helps others. I have a single word document in which I will need to run four separate loops. I think the best way to do this would be to run the first loop, save the document, run the second loop and append the data to the document, save again, then repeat the append and save steps for loops three and four. The other option is to do the first loop and immediately move into the next loop before doing the save. I cannot use a query, as loop one uses a single record for the customer, but the second, third and fourth loops use different sets of multiple records for the same customer.The downside of the second choice is, I believe, that the data is deleted as it is written at the end of each loop if it is not saved, as shown in your video. The code for multiple loops on a single document has me stymied. I believe the first option, where the data is saved before running the second loop, is the correct choice. However, after doing the save, do I close the word document and then reopen it using wdoc.content.insertafter, or do I leave it open and immediately proceed into the next loop? There will be multiple users, so speed is a consideration. If I do use the wdoc.content.insertafter coding, how would you suggest it be written in? This is my best guess in a stripped down version. My concern is that each time it saves, it will overwrite the form and remove the previously saved information, even though the bookmarks are in different locations. Please let me know where I've gone wrong? Perhaps, if you have time, suggest an alternative that would be more conducive than the approaches I have constructed? Thank you again, you are an incredibly gifted and generous teacher! Dim wApp As Word.Application Dim wDoc As Word.Document Set wApp = New Word.ApplicationSet wDoc = wApp.Documents.Open("C:\Documents\TEST.docx")Set rs = CurrentDb.OpenRecordset("TEST - Loop1", dbOpenDynaset, dbSeeChanges) If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("SiteNm").Range.Text = Nz(rs!SiteNm, "") wDoc.Bookmarks("SiteNm2").Range.Text = Nz(rs!SiteNm, "") wDoc.Bookmarks("SiteNm3").Range.Text = Nz(rs!SiteNm, "") wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_TEST.docx" wDoc.Bookmarks("SiteNm").Range.Delete wdCharacter, Len(Nz(rs!SiteNm, "")) wDoc.Bookmarks("SiteNm2").Range.Delete wdCharacter, Len(Nz(rs!SiteNm, "")) wDoc.Bookmarks("SiteNm3").Range.Delete wdCharacter, Len(Nz(rs!SiteNm, ""))rs.MoveNextLoopSet rs = CurrentDb.OpenRecordset("TEST - Loop2", dbOpenDynaset, dbSeeChanges) If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("OldNm").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm2").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm3").Range.Text = Nz(rs!OldNm, "") wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_ TEST.docx" wDoc.Bookmarks("OldNm").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm2").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm3").Range.Delete wdCharacter, Len(Nz(rs!OldNm, ""))rs.MoveNextLoopSet rs = CurrentDb.OpenRecordset("SPTSO - Loop3", dbOpenDynaset, dbSeeChanges)If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("OldNm4").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm5").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm6").Range.Text = Nz(rs!OldNm, "") wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_ TEST.docx" wDoc.Bookmarks("OldNm4").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm5").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm6").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) rs.MoveNext Loop Set rs = CurrentDb.OpenRecordset("SPTSO - Loop4", dbOpenDynaset, dbSeeChanges) If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("OldNm7").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm8").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm9").Range.Text = Nz(rs!OldNm, "") wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_ TEST.docx" wDoc.Bookmarks("OldNm7").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm8").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm9").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) rs.MoveNextLoop wDoc.Close False wApp.Quit Set wDoc = Nothing Set wApp = Nothing
Why not save all of the values to variables and just keep concatenating until all of your loops are done. Then insert the values from your variables into the word doc?
I think I'm confused. Could you please be a little more specific? For example, how can I save a value into a variable if the value has not yet been set? If the value keeps concatenating, by the time it's done, each value of the variable would be very long. I don't think I'm seeing what you are trying to communicate. I'm sorry. Help?
You are looping through records. Store the values from your records to a variable in VBA. Then when you're done looping through all of your records send the variable value to the bookmark.
You are super fast in your replies! I think I'm starting to understand it. Btw, I just looked at the original code I uploaded, and *PHEW* all the pretty formatting I spent 15 minutes setting up is gone! My embarrassed apologies... I have 114 fields. Would I need to create 114 variables, one for each field and bookmark?
Programming Made EZ, Great video! Thank you so much. One quick question: The video explains how to create a new doc for every record read; however, in my case, I have to populate a table in Word with however many records I read from my Access table. I save the Word document only when I reach EOF on my Access table. So, how do you do this? I can create Bookmarks for the first record, but how do I define Bookmarks for the second row on my Word table? Second, third, etc.
Many thanks to you Steve. You have helped me a lot. I have two questions Can I open the Microsoft word to print the info from access form by clicking a button? Could the source be a query instead of a table? appreciated!
Is it possible to print a specific record (not all records), for example search for a specific record through record ID, then export the record details to the word document. That what makes this code useful, otherwise mail merge can do the same thing. Thank you. BTW, do you have full courses like this on Udemy for example so that we can buy.
Hi thank you for your video. It has helped a lot. I have a question if one of the fields in Access table is a lookup field referrigng to a list from another table how do I amend your code to show the text from the list rather than its unique ID as this is what is happening when I try your code.
Thank u so much for your videos. I was able to use your code and merged to a word document template. However, my Word template has a table. Can you advise how I fill down a table template with the records in a query? I tried to search for this on the internet and wasn’t able to find help anywhere.
Great video, thank you. Just one note. When I use "Text Form Field" instead of "Bookmarks" for setting the place of each added word, I don't have to add coding to delete the words after each created file and the rest, as you showed on "deleting data" part. The code just creates the files with unique name and its corresponded unique data. The code is slightly different for that. I am not smart, just combined this code and the one from the similar method from T Golden Eye channel. Both are good.
First of thanks for the good explanation. As a complete novice to Access, gathering bits and pieces everywhere this helped a lot. One question I do have. In my table I also use check boxes. What do I need to add so that it also converts check boxes into word?
Hello Programming Made EZ! Excellent video and the clarity with which you explain it! The link to "Work files" is broken, would you please give me the files so that I can see the whole process well? Thank you!
Steve, Great tutorial. A question. I'm using ACCESS 1016. I entered the sample code as your were entering it on the video. I watched the video three times and got all of the compile errors out of the way then wanted to run the code. I tried to save it and lo and behold, there isn't a save or save as function on the files tab. Am I missing a permissions setting or have you got any idea. I tried running the code the first line "Dim wApp As Word.Application" throws a "/compile error" "user-defined type not defined". Any ideas?
VERY IMPORTANT Thanks a lot for tutorial. My aim is to create an Ms Access database to standard our workflow forms with facility of adding a QR code on the header with an output of MS Word document. Which is the best approach I can use?
Hi Steve, thank you so much for your videos, with no computer skill they have helped me build a database from nothing. However I am having an issue with the use of a query as a recordset. I have a query with data from 2 tables and the data from the fist table comes through ok but stops when it get to the second table. It come up with a runtime error and says that the collection is not available. If I put the data in to the first table it comes through ok. Am I doing something silly as this is driving me mad. Thank you in advance for your help.
Hi, Impressive tutorial. I have an access form to fill data. How can I filter current record (from access form) to word, to print in word format and to close the word after print. Much appreciated for your kind help.
Hi! thanks for this tutorial that was really great and solved to me many issues! I've 2 questions for you: after the file was saved it result blocked by winword and i cannot ope directly. instead of saving the file is possible to simply open it? thanks in advance Luciano
This single tutorial for such important process is not enough. It'll be better if you have a series of such tutorial. BTW, if you have a paid course on Udemy for example, kindly let me know so I can join in. Thank you
Programming I have one suggestion if you agree with me. I suggest if you can complete this video so an email can be sent to the person through Outlook. In That way the process will be 100% efficient and practical. I. Think I saw a video done by you that explains how to send email but if you could bring these two video together, that’ll be great tool that most subscribers need.
Hello steve, thank's for this great and helpful tutorial. Can you give us more exemples on how ms word work with ms access and also can we do the opposite, it mean's instead of exporting data to ms word, can we import data to ms access from ms word.
thanks... very good. I was looking something like that. but How do I just print one record in World.... lets say that I only want to sent to the docx document one record.
Do you have a video that covers this same material but multiple records for one document? Say for instance you want a template paragraph for a record using a bookmark and then you want that same paragraph created for the same bookmark but a different record within the same document. In short it would loop through the records and add the template table or paragraph for each record as needed. Thanks for the video it's great.
What's great about this tutorial is that each code is being explained, and the possible errors are being shown and then he shows how to solve it. Is it possible also to export to excel using bookmarks?
many for this very helpful video. it would be so great if you show us more videos about advanced things when exporting data from access to word like tables......
Hey man, your video was so helpful to me but i wonder if i can do this without do while. just generate a single word file depending on which id i'm on.
Programming I did everything on the video and worked fine. But when i have too many records, the code does a loop on the whole table before the last record added. For example if i add a new record with file number 3, it would be nice if it only generate only that file, whithout 1 or 2. I hope you understand what i mean.
Programming When you have 100 records and you add a new one, that code needs to loop on the previous 100 to reach the 101, i would like to generate a single word file depending on which record i'm on.
Hey, thanks for video! But how can i make a new Doc file with this scrypt and name of that new Doc file to be FirstName, because thats what i really need now. Please help!
Hi, Good evening At first thank your class, very good. Secondly, I would like to ask if you can help me. This code create a document for all the records in our database What I need is to create a document from the last record, not all documents every time I run this macro Can you help me
Thanks for the video! My screen keeps on freezing whenever I try to run the program - I have 24 input fields. Is this too much and causing my computer to crash?
HI Steve, I used the code in my database, a file dialogbox appears with the following message : "The document is locked for editing by another user", when I click cancel Run-time error '4198' Command Failed
I am struggling with the same issue! Actually I managed to get some code working to do this, but I get a weird error message. The first time I create a Word document from Word from with Bookmarks (filling it with data and picture attachments from Access), everything is fine, but after that if I try to do that again on a different record, I get an error message and Word instance stays pending..any thought on this?
Hello steve the bookmarks is deleted with the text after the first loop, and an error occurs in the second loop of the following line of code, as the bookmark does not exist in the document : wDoc.Bookmarks("bookmarkname").Range.Delete wdCharacter, Len(Nz(rs!field, " ")
I keep getting an error, and when I debug, it's going to the open line...but I'm closing the program manually each time before I run the code? I've also looked in task manager and seen that the only thing it shows is MSACCESS. Each time I have to open task manager, find the 'file in use' application and end it. Which is when I debug and it takes me to the wApp open line. Any ideas what could be causing that issue? Nevermind, I got it to work. I wasn't keeping my house tidy with a few of the objects, so it was leaving winword open. THanks for the Tut!
Wow. I never knew there was coding embedded in access. Can u make a video to code and export data from excel? I’d appreciate that, cause I work with tonnes of data from excel. Thanks so much
Hi Programming, for some reason my code is getting stuck at setting the rs. My recordset is a query, does that mean I have to do something special then?
i want to use it in a form so that when i search a record in form and click a button and i get the data in a word file. I tried this method and it worked the way you tought but i want to use it in a form with a button so that it will export that paritcular record. Can you please help!
I need exactly what you requested. Please let me know if you have got that. At the moment I can solve that by creating a normal query and export query result to word the using the same solution here.
Great Tutorial although I am getting an error which means the first Word Document is created and then a Debug error appears. The second document does not appear and word gets locked. Any ideas?
Sorry, here is the continuation of the message , I saied : a Run-time error '4198' Command Failed, occurs and the following line in the vba code is Highlighted in yellow : Set wDoc = wApp.Documents.Open("C:\Users....... where is the problem?
It's been so long that I have programmed since 95. Is there a way to get the text underline and bold without an extra space in front of the first words?
Is possible to send the text to word in a format "standard" . For example instead that the number appear in word like 81981. I want to look like 81,981.00. wDoc.Bookmarks("SumOfExpense").Range.Text = Nz(rs!SumOfExpense, "")
Hi , I am using Ms Access 2016 and i have a code in my file. DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, TableName:="Drops_Airports", FileName:=out_file, Hasfieldnames:=True, Range:="Airports" But when the above code is getting executed, i am receiving an error- Run time error 31532- Microsoft Access cannot export the data.
Hi Amit Sharma, thank you for your question. However I am afraid it is too specific to your situation for me to properly help in the comments section. Also please consider the time it would take to collect all the necessary information to help you. If you're looking for one-on-one help with a problem you can sign up as a member for $5 a month and submit questions directly to me with screen shots or even copies of your application. If necessary I will initiate a virtual meeting with you so you can screen share and work through the problem together. Unfortunately I cannot offer this service to everyone for free. I hope you understand. If you are looking for a free option to get help with this issue, you can always try one of the access forums such as www.accessforums.net/ or www.utteraccess.com/forum/ . The folks on those forums do a terrific job of helping people in their free time.
I use access to create bulletins. I set the fields as long text. in Word I created the bookmarks as unlimited. I am using a form, after I enter the information I click a button to transfer the fields over to Word but it will only send the fields with less than 255 characters. the fields that are over Word displays the default characters in the bookmark? What should I check to correct?
When I try to delete the third word document created by the code . I receive this error " The action can't be completed because the file is open in Word 2016" the error ins not true , I already have Word 2016 close . Maybe I need do add another code like Documents.Close ?
+Programming support.microsoft.com/en-us/kb/278378 ... this link are the guide.. but the code there cant move multiple selected and I failed to understand the logic of the code (noob here :D).. I really hope you can make the tutorial regarding this and explain the logic of the code behind it. I really2 enjoy all your tutorial coz you explain very detail, including the logic behind the code, thanks
I think you would run into a problem of the macro not working on a window outside of Excel. It's been a long time since I've made an Excel macro though.
You can try this reading this stackoverflow.com/questions/35600191/try-catch-finally-in-vb-net, or be sure the file is close or not process is using it. Let me know how it goes
Why do I get an error at the first line of code when I run it, this line: Dim wApp As Word.Application error message: compile error: user-defined type not defined
Struggling to get past run time error '3078' - it has something to do with - Set rs = CurrentDb.OpenRecordset("tblNames") for some reason the system wont let me past this point? Can anyone help me?
The problem I'm having is ridiculous, however I have to deal with it. What I have done is grabbed data from a form in a share point, converted it to Microsoft access with the intention of filling in other Word forms automatically to go to other departments. The problem might be to do with the table names, however being I'm a little older and new to Microsoft Access I don't know how to get around the following: the form in the share-point asks questions like - Number of shifts, Work-site Type and Work From Suburb etc. Being questions are two and three word questions when it is converted to Microsoft access the table names appear asd those questions. Then when I set up the word document 'Bookmarks' it only excepts the questions as a single word and doesn't seem to recognise the multi word table names? And I have no idea how to get around that? Any help is appreciated.
After your second pass through the word documents' creations, where the third letter's information was missing, you should have said, "And like that [poof], it's gone."
I will probably not be going over that since it is very complicated and frankly shouldn't be done. Word is not a place for storing data. It's understandable with Excel, but Word documents are meant for output, not input.
Great Tutorial. I know you can help me with this. I need to get the data from a Word Form and put it in a Access Table. The problem is that the Word Form Fields are NOT setup in Column - Row format as Access and Excel. It is set up like this for example: Please Advise and thank you again for sharing your knowledge and experience with us. First Name: TJ Last Name: Johnson Middle Name: Marie Address: 123 Any Street City: Any town State: Any State Phone Number: 111-111-1111 and so on.
Please help me. i want to use this code to export the selected record only to word. i tried this it exports all records present in word. i want to know how export only a selected record to word.
There's no one who makes tutorials like you Steve Bishop
Thank you!
Classy tutorial Steve, you have the gift of taking a complex subject and breaking it up into simple clear steps. keep up the good work.
Thank you!
This is one of the most BA and useful videos I've found.
Thank You for making such a wonderful video. Does it still work in Access 2019? I am not getting the Bookmarks control when I am trying to assigning field name to bookmarks field.
Hi Steve...Thanks for the great video...I need to ask here if I have option to add the word template to the access resources instead of my computer?
Hi,
Steve! Your videos have helped me in my project immensely, and I truly appreciate them, thank you! I hope this question helps others.
I have a single word document in which I will need to run four separate loops. I think the best way to do this would be to run the first loop, save the document, run the second loop and append the data to the document, save again, then repeat the append and save steps for loops three and four. The other option is to do the first loop and immediately move into the next loop before doing the save. I
cannot use a query, as loop one uses a single record for the customer, but the second, third and fourth loops use different sets of multiple records for the same customer.The downside of the second choice is, I believe, that the data is deleted as it is written at the end of each loop if it is not saved, as shown in your video. The code for multiple loops on a single document has me stymied. I believe the first option, where the data is saved before running the second loop, is the correct choice. However, after doing the save, do I close the word document and then reopen it using wdoc.content.insertafter, or do I leave it open and immediately proceed into the next loop? There will be multiple users, so speed is a consideration. If I do use the wdoc.content.insertafter coding, how would you suggest it be written in?
This is my best guess in a stripped down version. My concern is that each time it saves, it will overwrite the form and remove the previously saved information, even though the bookmarks are in different locations. Please let me know where I've gone wrong? Perhaps, if you have time, suggest an alternative that would be more conducive than the approaches I have constructed? Thank you again, you are an incredibly gifted and generous teacher!
Dim wApp As Word.Application
Dim wDoc As Word.Document
Set wApp = New Word.ApplicationSet wDoc = wApp.Documents.Open("C:\Documents\TEST.docx")Set rs = CurrentDb.OpenRecordset("TEST - Loop1", dbOpenDynaset, dbSeeChanges)
If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("SiteNm").Range.Text = Nz(rs!SiteNm, "") wDoc.Bookmarks("SiteNm2").Range.Text = Nz(rs!SiteNm, "") wDoc.Bookmarks("SiteNm3").Range.Text = Nz(rs!SiteNm, "") wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_TEST.docx" wDoc.Bookmarks("SiteNm").Range.Delete wdCharacter, Len(Nz(rs!SiteNm, "")) wDoc.Bookmarks("SiteNm2").Range.Delete wdCharacter, Len(Nz(rs!SiteNm, "")) wDoc.Bookmarks("SiteNm3").Range.Delete wdCharacter, Len(Nz(rs!SiteNm, ""))rs.MoveNextLoopSet rs = CurrentDb.OpenRecordset("TEST - Loop2", dbOpenDynaset, dbSeeChanges)
If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("OldNm").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm2").Range.Text = Nz(rs!OldNm, "")
wDoc.Bookmarks("OldNm3").Range.Text = Nz(rs!OldNm, "")
wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_ TEST.docx" wDoc.Bookmarks("OldNm").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm2").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm3").Range.Delete wdCharacter, Len(Nz(rs!OldNm, ""))rs.MoveNextLoopSet rs = CurrentDb.OpenRecordset("SPTSO - Loop3", dbOpenDynaset, dbSeeChanges)If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("OldNm4").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm5").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm6").Range.Text = Nz(rs!OldNm, "") wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_ TEST.docx" wDoc.Bookmarks("OldNm4").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm5").Range.Delete wdCharacter, Len(Nz(rs!OldNm, ""))
wDoc.Bookmarks("OldNm6").Range.Delete wdCharacter, Len(Nz(rs!OldNm, ""))
rs.MoveNext
Loop
Set rs = CurrentDb.OpenRecordset("SPTSO - Loop4", dbOpenDynaset, dbSeeChanges)
If Not rs.EOF Then rs.MoveFirst Do Until rs.EOF wDoc.Bookmarks("OldNm7").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm8").Range.Text = Nz(rs!OldNm, "") wDoc.Bookmarks("OldNm9").Range.Text = Nz(rs!OldNm, "") wDoc.SaveAs2 "C:\Documents\" & rs!SiteNm & "_" & rs!SiteCity & "_ TEST.docx" wDoc.Bookmarks("OldNm7").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm8").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) wDoc.Bookmarks("OldNm9").Range.Delete wdCharacter, Len(Nz(rs!OldNm, "")) rs.MoveNextLoop
wDoc.Close False
wApp.Quit
Set wDoc = Nothing
Set wApp = Nothing
Why not save all of the values to variables and just keep concatenating until all of your loops are done. Then insert the values from your variables into the word doc?
I think I'm confused. Could you please be a little more specific? For example, how can I save a value into a variable if the value has not yet been set? If the value keeps concatenating, by the time it's done, each value of the variable would be very long. I don't think I'm seeing what you are trying to communicate. I'm sorry. Help?
You are looping through records. Store the values from your records to a variable in VBA. Then when you're done looping through all of your records send the variable value to the bookmark.
You are super fast in your replies! I think I'm starting to understand it. Btw, I just looked at the original code I uploaded, and *PHEW* all the pretty formatting I spent 15 minutes setting up is gone! My embarrassed apologies... I have 114 fields. Would I need to create 114 variables, one for each field and bookmark?
Almost 3 years later after video release and it still works perfect! Thanks a lot!
Programming Made EZ, Great video! Thank you so much. One quick question: The video explains how to create a new doc for every record read; however, in my case, I have to populate a table in Word with however many records I read from my Access table. I save the Word document only when I reach EOF on my Access table. So, how do you do this? I can create Bookmarks for the first record, but how do I define Bookmarks for the second row on my Word table? Second, third, etc.
terima kasih ... terima kasih.....
aku sudah 1 bulan mencari trik ini dan akhirnya dapat disini
Many thanks to you Steve. You have helped me a lot.
I have two questions
Can I open the Microsoft word to print the info from access form by clicking a button?
Could the source be a query instead of a table?
appreciated!
This is a solid tutorial. I'm definitely checking out your other videos. Thank you!
Is it possible to print a specific record (not all records), for example search for a specific record through record ID, then export the record details to the word document. That what makes this code useful, otherwise mail merge can do the same thing.
Thank you.
BTW, do you have full courses like this on Udemy for example so that we can buy.
Yes, create a query and select the control that is used to specify the record
Hi thank you for your video. It has helped a lot. I have a question if one of the fields in Access table is a lookup field referrigng to a list from another table how do I amend your code to show the text from the list rather than its unique ID as this is what is happening when I try your code.
Thank u so much for your videos. I was able to use your code and merged to a word document template. However, my Word template has a table. Can you advise how I fill down a table template with the records in a query? I tried to search for this on the internet and wasn’t able to find help anywhere.
Great video, thank you. Just one note. When I use "Text Form Field" instead of "Bookmarks" for setting the place of each added word, I don't have to add coding to delete the words after each created file and the rest, as you showed on "deleting data" part. The code just creates the files with unique name and its corresponded unique data. The code is slightly different for that.
I am not smart, just combined this code and the one from the similar method from T Golden Eye channel. Both are good.
Very informative video, it helped a great deal. One question, what is the best way to print the Doc before it is saved?
thanks for the superb video's. they are realy clear and you have a very pleasant voice to listen to, so thumbs up
Great and complete explanation on this topic
What a wonderful explanation! Thank you so much. I'm excited to use this method.
Thank you for this Steve, is there a way to do the exact same thing in excel ?
First of thanks for the good explanation. As a complete novice to Access, gathering bits and pieces everywhere this helped a lot. One question I do have. In my table I also use check boxes. What do I need to add so that it also converts check boxes into word?
Hello Programming Made EZ! Excellent video and the clarity with which you explain it! The link to "Work files" is broken, would you please give me the files so that I can see the whole process well? Thank you!
Steve, Great tutorial. A question. I'm using ACCESS 1016. I entered the sample code as your were entering it on the video. I watched the video three times and got all of the compile errors out of the way then wanted to run the code. I tried to save it and lo and behold, there isn't a save or save as function on the files tab. Am I missing a permissions setting or have you got any idea. I tried running the code the first line "Dim wApp As Word.Application" throws a "/compile error" "user-defined type not defined". Any ideas?
Thanks, very helpful. Liked the "Mad" use of Alfred E Neuman.
Thanks for the tutorial Steve. Excellent --as usual.
Great work, thank you
hi im iranian you are a best tankkkkkkks
VERY IMPORTANT
Thanks a lot for tutorial.
My aim is to create an Ms Access database to standard our workflow forms with facility of adding a QR code on the header with an output of MS Word document.
Which is the best approach I can use?
I keep getting error 91, object variable or with block varible not set.... frustrating
Hi Steve, thank you so much for your videos, with no computer skill they have helped me build a database from nothing. However I am having an issue with the use of a query as a recordset. I have a query with data from 2 tables and the data from the fist table comes through ok but stops when it get to the second table. It come up with a runtime error and says that the collection is not available. If I put the data in to the first table it comes through ok. Am I doing something silly as this is driving me mad. Thank you in advance for your help.
Hi, Impressive tutorial.
I have an access form to fill data.
How can I filter current record (from access form) to word, to print in word format and to close the word after print.
Much appreciated for your kind help.
Hi! thanks for this tutorial that was really great and solved to me many issues! I've 2 questions for you: after the file was saved it result blocked by winword and i cannot ope directly.
instead of saving the file is possible to simply open it? thanks in advance
Luciano
This single tutorial for such important process is not enough. It'll be better if you have a series of such tutorial.
BTW, if you have a paid course on Udemy for example, kindly let me know so I can join in.
Thank you
I have 2 entire courses on Access 2013, and I'm starting a 3rd on 2016. They're listed in my channel.
Programming I have one suggestion if you agree with me. I suggest if you can complete this video so an email can be sent to the person through Outlook. In That way the process will be 100% efficient and practical. I. Think I saw a video done by you that explains how to send email but if you could bring these two video together, that’ll be great tool that most subscribers need.
Hello steve, thank's for this great and helpful tutorial. Can you give us more exemples on how ms word work with ms access and also can we do the opposite, it mean's instead of exporting data to ms word, can we import data to ms access from ms word.
thanks... very good. I was looking something like that. but How do I just print one record in World.... lets say that I only want to sent to the docx document one record.
Then instead of making your recordset the entire table, do a SQL Query that pulls the one record.
Do you have a video that covers this same material but multiple records for one document? Say for instance you want a template paragraph for a record using a bookmark and then you want that same paragraph created for the same bookmark but a different record within the same document. In short it would loop through the records and add the template table or paragraph for each record as needed. Thanks for the video it's great.
Thank you so much! This was organized and helpful!
Thank you! Exactly what I needed!
Alfred E Neman🤣 The name from Mad Magazine Game. That just brought back some good memories!
thanks this is very helpfull to me....
What's great about this tutorial is that each code is being explained, and the possible errors are being shown and then he shows how to solve it. Is it possible also to export to excel using bookmarks?
many for this very helpful video. it would be so great if you show us more videos about advanced things when exporting data from access to word like tables......
wow thank u so much i dont have word to show my gratitude to you...love u man love u so mu h
Heh.. well thank man. I'm glad I can make videos people enjoy.
That's a really a nice tutorial. Can we do the same using excel?
Great work --- Thank you much!
As a total novice very simply put. What if i only want to export and print) the current record that is displayed from a form that sits over the table?
Hey man, your video was so helpful to me but i wonder if i can do this without do while. just generate a single word file depending on which id i'm on.
What don't you understand to do?
Programming I did everything on the video and worked fine. But when i have too many records, the code does a loop on the whole table before the last record added. For example if i add a new record with file number 3, it would be nice if it only generate only that file, whithout 1 or 2. I hope you understand what i mean.
Programming When you have 100 records and you add a new one, that code needs to loop on the previous 100 to reach the 101, i would like to generate a single word file depending on which record i'm on.
Then just don't do a loop. Use a SQL String to get the one record you want for your recordset.
Programming Ok, ¿any suggestion to find a tutorial to do that?
Hey, thanks for video! But how can i make a new Doc file with this scrypt and name of that new Doc file to be FirstName, because thats what i really need now. Please help!
thank you very much steve
Can you create another video for exporting an individual record to ms word.
Hi, Good evening
At first thank your class, very good.
Secondly, I would like to ask if you can help me.
This code create a document for all the records in our database
What I need is to create a document from the last record, not all documents every time I run this macro
Can you help me
Thanks for the video! My screen keeps on freezing whenever I try to run the program - I have 24 input fields. Is this too much and causing my computer to crash?
It sounds like you have an infinite loop somewhere.
HI Steve,
I used the code in my database, a file dialogbox appears with the following message :
"The document is locked for editing by another user", when I click cancel Run-time error '4198' Command Failed
hi thanks for a great tutorial.. by the way how can i bookmark an image which the database contain only the location of an image..
I am struggling with the same issue! Actually I managed to get some code working to do this, but I get a weird error message. The first time I create a Word document from Word from with Bookmarks (filling it with data and picture attachments from Access), everything is fine, but after that if I try to do that again on a different record, I get an error message and Word instance stays pending..any thought on this?
can we get the code? that you have written there?
not for image but in this tutorial
Hello steve
the bookmarks is deleted with the text after the first loop, and an error occurs in the second loop of the following line of code, as the bookmark does not exist in the document :
wDoc.Bookmarks("bookmarkname").Range.Delete wdCharacter, Len(Nz(rs!field, " ")
I keep getting an error, and when I debug, it's going to the open line...but I'm closing the program manually each time before I run the code? I've also looked in task manager and seen that the only thing it shows is MSACCESS. Each time I have to open task manager, find the 'file in use' application and end it. Which is when I debug and it takes me to the wApp open line. Any ideas what could be causing that issue?
Nevermind, I got it to work. I wasn't keeping my house tidy with a few of the objects, so it was leaving winword open. THanks for the Tut!
Wow. I never knew there was coding embedded in access. Can u make a video to code and export data from excel? I’d appreciate that, cause I work with tonnes of data from excel. Thanks so much
Hi Programming, for some reason my code is getting stuck at setting the rs. My recordset is a query, does that mean I have to do something special then?
The code I am trying to use is Set rs = CurrentDb.OpenRecordset(Query![Notice Q])
Men one cuestion, can I write a table in Word with access and VBA??
Yes.
Programming how?? :-D
Hi thank you for your video, please l need export access report to excel with formatting
i want to use it in a form so that when i search a record in form and click a button and i get the data in a word file.
I tried this method and it worked the way you tought but i want to use it in a form with a button so that it will export that paritcular record.
Can you please help!
I need exactly what you requested. Please let me know if you have got that. At the moment I can solve that by creating a normal query and export query result to word the using the same solution here.
Thanks for the tutorial .. in my case I want to make only one record set which i have to select into word doc
can you help me with the right code I placed a combobox to select my recordset and I want this record set to be posted in word doc
Good stuff. Thanks!
Thank you! Glad you like it.
How do I make it so the file is only created for the last record from the record set ?
Great Tutorial although I am getting an error which means the first Word Document is created and then a Debug error appears. The second document does not appear and word gets locked. Any ideas?
Thank you!
Can you re upload the sample file? 🙂
You're a legend. Nice tutorial!!
Thank you!
Supi, if I have "n" Access DB's, how you define from which DB should I take the data
Since the code is in the Access database, I'm not sure what you mean.
Sorry Steve, I did not realize, that you have placed the code in an Access - module. Now, everything is clear.
Thank you.
Regards
Daniel
Sorry, here is the continuation of the message ,
I saied : a Run-time error '4198' Command Failed, occurs and the following line in the vba code is Highlighted in yellow : Set wDoc = wApp.Documents.Open("C:\Users.......
where is the problem?
Can you write the code for fill the shapes background color in word by access?
wonderful thanks a lot
You are welcome! Tell your friends!
@@ProgrammingMadeEZ link broken, can you send me sample file imankadarisman@ymail.com
It's been so long that I have programmed since 95. Is there a way to get the text underline and bold without an extra space in front of the first words?
How to create many word files using many query records?
Is possible to send the text to word in a format "standard" . For example instead that the number appear in word like 81981.
I want to look like 81,981.00.
wDoc.Bookmarks("SumOfExpense").Range.Text = Nz(rs!SumOfExpense, "")
I found how :
wDoc.Bookmarks("SumOfExpense").Range.Text = Nz(Format(rs!SumOfExpense, "Standard"), "")
Hi , I am using Ms Access 2016 and i have a code in my file.
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12Xml, TableName:="Drops_Airports", FileName:=out_file, Hasfieldnames:=True, Range:="Airports"
But when the above code is getting executed, i am receiving an error- Run time error 31532- Microsoft Access cannot export the data.
Hi Amit Sharma, thank you for your question. However I am afraid it is too specific to your situation for me to properly help in the comments section. Also please consider the time it would take to collect all the necessary information to help you. If you're looking for one-on-one help with a problem you can sign up as a member for $5 a month and submit questions directly to me with screen shots or even copies of your application. If necessary I will initiate a virtual meeting with you so you can screen share and work through the problem together. Unfortunately I cannot offer this service to everyone for free. I hope you understand.
If you are looking for a free option to get help with this issue, you can always try one of the access forums such as www.accessforums.net/ or www.utteraccess.com/forum/ . The folks on those forums do a terrific job of helping people in their free time.
Hey..thanks for your response ..yes I will opt for either of the options however at this particular time I have solved it.. 😊
How to export query (many to many) to ms word?
I can't get this to work in my version.
What is the limit on each field you send to word (how many characters per field (maximum))?
I don't believe there is a cap for the Word document, so it would only be limited to the data you store in the field of the database.
I use access to create bulletins. I set the fields as long text. in Word I created the bookmarks as unlimited. I am using a form, after I enter the information I click a button to transfer the fields over to Word but it will only send the fields with less than 255 characters. the fields that are over Word displays the default characters in the bookmark? What should I check to correct?
Without testing it out I don't know what to tell you. Sorry.
Thanks, I will keep looking it's probably something simple that I am overlooking. I appreciate your videos, they have been a great help.
When I try to delete the third word document created by the code . I receive this error " The action can't be completed because the file is open in Word 2016" the error ins not true , I already have Word 2016 close . Maybe I need do add another code like Documents.Close ?
I search and look like is a Windows errors not related to the code , I reboot the machine. to suppress this warning .
It sounds like the document is still open in the background. You should be doing a document.close after you are done with each document.
can you do the samething but put the data into a table.
Hi i need the work file
Is there a way to export one Form from Access to Word?
A form? I've never tried, but I don't think so. I don't believe access forms exist in a Word document.
hi.. can you make a tutorial for add item to listbox from another listbox in form... thank you
Can you give an example?
+Programming support.microsoft.com/en-us/kb/278378 ... this link are the guide.. but the code there cant move multiple selected and I failed to understand the logic of the code (noob here :D).. I really hope you can make the tutorial regarding this and explain the logic of the code behind it. I really2 enjoy all your tutorial coz you explain very detail, including the logic behind the code, thanks
I am still getting duplicates. How do I fix it?
vba error variable not defined what to do
Thank you
You're welcome!
Do you know how to import info from a pdf to word and sort it with visual basic ?
PDF's are proprietary. You would need a 3rd party library to access data inside of a PDF.
Programming Could you have a macro highlight it then put it in excel. Then have excel sort it ?
I think you would run into a problem of the macro not working on a window outside of Excel. It's been a long time since I've made an Excel macro though.
Programming Thanks for the replys
Ok. Good video. Now what about exporting a report (formatting and all) to a Word document?1
Is there resolution for the "Already Open Error?"
You can try this reading this stackoverflow.com/questions/35600191/try-catch-finally-in-vb-net, or be sure the file is close or not process is using it. Let me know how it goes
Why do I get an error at the first line of code when I run it, this line:
Dim wApp As Word.Application
error message:
compile error:
user-defined type not defined
I’m getting this same error message. Did you ever figure this out?
@@andrianarowe4946 Me to
what about putting data into power point
I'll see if I have time to make a video on this.
Struggling to get past run time error '3078' - it has something to do with - Set rs = CurrentDb.OpenRecordset("tblNames")
for some reason the system wont let me past this point? Can anyone help me?
Looks like you don't have a tale by the name tblNames.
The problem I'm having is ridiculous, however I have to deal with it. What I have done is grabbed data from a form in a share point, converted it to Microsoft access with the intention of filling in other Word forms automatically to go to other departments. The problem might be to do with the table names, however being I'm a little older and new to Microsoft Access I don't know how to get around the following: the form in the share-point asks questions like - Number of shifts, Work-site Type and Work From Suburb etc. Being questions are two and three word questions when it is converted to Microsoft access the table names appear asd those questions. Then when I set up the word document 'Bookmarks' it only excepts the questions as a single word and doesn't seem to recognise the multi word table names? And I have no idea how to get around that? Any help is appreciated.
Can you explain in access 2019?
After your second pass through the word documents' creations, where the third letter's information was missing, you should have said, "And like that [poof], it's gone."
Hi steve,
what about importing data from ms word table to ms access?
think you again for this wonderful course that's help me to improve my database.
I will probably not be going over that since it is very complicated and frankly shouldn't be done. Word is not a place for storing data. It's understandable with Excel, but Word documents are meant for output, not input.
error to download file
Great Tutorial. I know you can help me with this. I need to get the data from a Word Form and put it in a Access Table. The problem is that the Word Form Fields are NOT setup in Column - Row format as Access and Excel. It is set up like this for example: Please Advise and thank you again for sharing your knowledge and experience with us.
First Name: TJ Last Name: Johnson Middle Name: Marie
Address: 123 Any Street City: Any town State: Any State
Phone Number: 111-111-1111 and so on.
this is so confusing
Erica White how?
Please help me.
i want to use this code to export the selected record only to word.
i tried this it exports all records present in word.
i want to know how export only a selected record to word.