473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to use .FormFields to fill numerous records under the same column

I am using .FormFields to fill a quotation template in Word, but the subform I am retrieving the data from has rows of records under each column and I need to send more than just the first row to fill the required bookmarks in Word.

The code i'm using is

Expand|Select|Wrap|Line Numbers
  1. Set doc = appWord.Documents.Open("S:\Templates\Quotation Template - Test.doc", , True)
  2. With doc
  3. .FormFields("FirstName").Result = Me!FirstName
  4. .FormFields("FirstName2").Result = Me!FirstName
  5. .FormFields("LastName").Result = Me!LastName
  6. .FormFields("LastName2").Result = Me!LastName
  7. .FormFields("CompanyName").Result = Me!CompanyName
  8. .FormFields("CompanyName2").Result = Me!CompanyName
  9. .FormFields("Address1").Result = Me!Address1
  10. .FormFields("Address1_2").Result = Me!Address1
  11. .FormFields("Address2").Result = Me!Address2
  12. .FormFields("Address2_2").Result = Me!Address2
  13. .FormFields("Address3").Result = Me!Address3
  14. .FormFields("Address3_2").Result = Me!Address3
  15. .FormFields("fldRegion").Result = Me!Region
  16. .FormFields("PostalCode").Result = Me!PostalCode
  17. .FormFields("PostalCode2").Result = Me!PostalCode
  18. .FormFields("emailname").Result = Me!EmailName
  19. .FormFields("emailname2").Result = Me!EmailName
  20. .FormFields("QuoteReference").Result = Me!QuoteReference
  21. .FormFields("QuoteReference2").Result = Me!QuoteReference
  22. .FormFields("QuoteProjectName").Result = Me!QuoteProjectName
  23. .FormFields("QuoteProjectName2").Result = Me!QuoteProjectName
  24. .FormFields("QuoteDate").Result = Me!QuoteDate
  25. .FormFields("QuoteDate2").Result = Me!QuoteDate
  26. .FormFields("txtVatValue").Result = Me!txtVatValue
  27. .FormFields("txtTotal").Result = Me!txtTotal
  28. .FormFields("txtSubTotal").Result = Me!txtSubTotal
  29. .FormFields("cmbStaff").Result = Me!cmbStaff
  30.  
  31. .FormFields("ProductID").Result = Me.[frmQuotesSub].Form.[ProductID]
  32. .FormFields("Qty").Result = Me.[frmQuotesSub].Form.[Qty]
  33. .FormFields("UnitPrice").Result = Me.[frmQuotesSub].Form.[UnitPrice]
  34. .FormFields("ExtendedPrice").Result = Me.[frmQuotesSub].Form.[ExtendedPrice]


Jan 26 '15 #1
7 1293
twinnyfo
3,653 Expert Mod 2GB
You might be better off using a recordset for the MS Access data and then cycling through. However, you did not provide a whole lot of information that describes your db and how it is structured.
Jan 26 '15 #2
A quotation is made in access as shown on screenshot 2. The data on this form then fills bookmarks in Word shown on screenshot 1. The quotes can contain more than 1 product ID (I've shown 2 in the list). When i export this to Word it fills only the first column of my table. I need to specify on the FormFill to retrieve data from the second row (record 2) to be able to fill the second column in my Word template.

Is there a way you can briefly describe the process of using a recordset for the data?

Many thanks.
Jan 27 '15 #3
twinnyfo
3,653 Expert Mod 2GB
I am unable to see your screenshots here at work, so I am a little unclear about how this is being used. Perhaps paste your screenshots into a Word Doc and I should be able to see them.

Perhaps the screenshots will help me understand your problem a bit more clearly, as I need to see what is being updated and how.

If your Template does not contain any proprietary or confidential information, you can also attach that, to help us look at what you are trying to do.

We'll get there.... We just need to figure out how to go about it.
Jan 27 '15 #4
http://www.landscapetreesecology.com...creenshots.doc

Apologies for the late response. I'm afraid I can't share the template as it is for work purposes, but I have shared a link with the screenshots in a Word document. I hope this helps and many thanks for your time on this.
Feb 2 '15 #5
twinnyfo
3,653 Expert Mod 2GB
P.S., an easier way to send a Word Doc is to attach it (Don't use links, as they can be finicky for some people's work network systems).

I'll take a look and see what I can see....
Feb 2 '15 #6
Rushed this reply earlier and forgot to click the 'advanced' button. I will take note of this next time. Thanks!
Feb 2 '15 #7
twinnyfo
3,653 Expert Mod 2GB
I think one of your challenges may be the insertion of the form fields in Word with each consecutive record. I have not automated MS Word form fields with MS Access, although I am sure it can be done.

However, I think an easier solution would be to generate a report in MS Access and then export it, preferably in PDF--but RTF would work for opening in Word. I prefer PDF because it is more difficult to modify, but it is a universal document format.
Feb 2 '15 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: hjyn | last post by:
Hi All, I create a form for the user to enter the information, the form contains two table, table A and table B. I wrote a script to prompt the user to fill all the necessary data if they miss to...
6
by: python1 | last post by:
I apologize if this is redundant. How would one fill an empty column with a sequence of numbers? The column exists in a table with aproximately 1000000 rows of data. I believe in oracle the...
1
by: Broida (spamless) | last post by:
Hi! I have a list of item and I need to populate two columns with all of the combinations (not permutations), omitting the paired elements. Example: If my list in column A has W, X, Y, Z. ...
8
by: John Baker | last post by:
Hi: Access 2000 W98! I have a table with numerous records in it, and am attempting to delete certain records that have been selected from it. These are selected based on the ID number in a...
24
by: Mike Otten | last post by:
Any help greatly appreciated. The validated page is at: http://myweb.stedwards.edu/michaelo/ddtab.htm The trouble is with the radio buttons (2/3-down the left column). The radios are...
0
by: krishnarjun | last post by:
hi to all, suppose i created a sql table with one field..........then i inserted 5 records on that table....... if i use datagrid for accessing these records it ll shows all the records row...
0
by: ChuckB | last post by:
How would one fill a datagrid column by column? I have a function that propagates an array, as array1 runs I want to have the values fill column 1, when it completes, array2 runs and fills...
5
by: Nathan Sokalski | last post by:
I want to select only the first n records from a database using VB.NET. I have declared a DataTable and OleDB.OleDbDataAdapter as follows: Dim linkstable As New DataTable Dim linksadapter As New...
0
by: dan | last post by:
Hi, I have a multi-line textbox in a gridview when in edit mode. The textbox (rendered as textarea in browser) set cols to 20 by default. I'd like the textbox to 'adjust' itself to the width...
3
by: Motawee | last post by:
i am making a windows form application that contains a datagridview that is filled with employees names the program is for the attendance absence holidays of employees in the company so i...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.