UrbanPro

Learn Microsoft Excel Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

How do I write HTML code to export form data into MS Access or Excel?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

yes, you can In your HTML form firstly you need to create a separate table In the create id tags and thereafter you use a JavaScript to replace the inner HTML with the value of the fields on your form from where it collects the data you want. please check below mention example, <!DOCTYPE...
read more

yes, you can

In your HTML form firstly you need to create a separate table 

In the create id tags and thereafter you use a JavaScript to replace the inner HTML with the value of the fields on your form from where it collects the data you want. 

please check below mention example,

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script type="text/javascript">
  5. function fillHidTable1(){
  6. var htqf1; //-- hidden field
  7. var rf1; //-- retrieved field
  8. for ( var i = 1; i < 5; i++ ) {
  9. rf1 = "htqf"+i;
  10. document.getElementById(rf1).innerHTML = document.getElementById("Q1"+i+"CALC1").value;
  11. }
  12. tableToExcel('hidTable1', 'Analysis Results1');
  13. }
  14.  
  15. var tableToExcel1 = (function() {
  16. var uri = 'data:application/vnd.ms-excel;base64,'
  17. , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
  18. , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
  19. , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
  20. return function(table, name) {
  21. if (!table.nodeType) table = document.getElementById(table)
  22. var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
  23. window.location.href = uri + base64(format(template, ctx))
  24. }
  25. })()
  26. </script>
  27.  
  28. <title>HTML Form Data to Excel</title>
  29.  
  30. <style type="text/css" media="screen">
  31. .divCenMid{font-family:Arial,sans-serif;font-size:14pt;font-style:normal;font-weight:700;text-align:center;vertical-align:middle;margin:0;}
  32. .allbdrCenMid{border:.75pt solid windowtext;color:#000;font-family:Arial,sans-serif;font-size:10pt;font-style:normal;font-weight:400;text-align:center;vertical-align:middle;margin:0;}
  33. .allbdrCenTop{border:.75pt solid windowtext;color:#000;font-family:Arial,sans-serif;font-size:10pt;font-style:normal;font-weight:400;text-align:center;vertical-align:top;margin:0;}
  34. .allbdrLtMid{border:.75pt solid windowtext;color:#000;font-family:Arial,sans-serif;font-size:10pt;font-style:normal;font-weight:400;text-align:left;vertical-align:middle;margin:0;}
  35. .allbdrLtTop{border:.75pt solid windowtext;color:#000;font-family:Arial,sans-serif;font-size:10pt;font-style:normal;font-weight:400;text-align:left;vertical-align:top;margin:0;}
  36.  
  37. </style>
  38.  
  39. </head>
  40.  
  41. <body>
  42.  
  43. <table width= "565px" cellspacing="0" cellpadding="0" style="border-spacing:0;" id="QMSTable">
  44. <col width="25px"/>
  45. <col width="120px"/>
  46. <col width="360px"/>
  47. <col width="60px"/>
  48. <tr>
  49. <td class="divCenMid1" colspan = "4"> QMS Assessment</td>
  50. </tr>
  51. <tr>
  52. <td class="allbdrCenMid1"> No</td>
  53. <td class="allbdrCenMid1"> Criteria</td>
  54. <td class="allbdrLtMid1"> Question</td>
  55. <td class="allbdrCenMid1"> Score</td>
  56. </tr>
  57. <tr>
  58. <td class="allbdrCenTop"> Q1</td>
  59. <td class="allbdrLtTop"> Quality Unit Independency</td>
  60. <td class="allbdrLtTop"> Do you have the Quality Unit?</td>
  61. <td class="allbdrCenMid">
  62. <input id="Q1CALC" type="text" value="" class="nobdrCenMid" style="overflow:hidden; width:93% " name="Q1CALC"/>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td class="allbdrCenTop"> Q2</td>
  67. <td class="allbdrLtTop"> Apply PICS GMP</td>
  68. <td class="allbdrLtTop"> Which GMP regulation do you use?</td>
  69. <td class="allbdrCenMid">
  70. <input id="Q2CALC" type="text" value="" class="nobdrCenMid" style="overflow:hidden; width:93% " name="Q2CALC"/>
  71. </td>
  72. </tr>
  73. <tr>
  74. <td class="allbdrCenTop"> Q3</td>
  75. <td class="allbdrLtTop"> Deviation or Non-conformance</td>
  76. <td class="allbdrLtTop"> Do you have a deviation or non-conformance procedure?</td>
  77. <td class="allbdrCenMid">
  78. <input id="Q3CALC" type="text" value="" class="nobdrCenMid" style="overflow:hidden; width:93% " name="Q3CALC"/>
  79. </td>
  80. </tr>
  81. <tr>
  82. <td class="allbdrCenTop"> Q4</td>
  83. <td class="allbdrLtTop"> Complaint</td>
  84. <td class="allbdrLtTop"> Do you have a customer complaint procedure?</td>
  85. <td class="allbdrCenMid">
  86. <input id="Q4CALC" type="text" value="" class="nobdrCenMid" style="overflow:hidden; width:93% " name="Q4CALC"/>
  87. </td>
  88. </tr>
  89. </table>
  90.  
  91. <div id="hidTable" style="display: none">
  92. <table id="testTable">
  93. <caption>Supplier Risk Analysis</caption>
  94. <colgroup></colgroup>
  95. <colgroup></colgroup>
  96. <colgroup></colgroup>
  97. <thead>
  98. <tr>
  99. <th>No.</th>
  100. <th>Question</th>
  101. <th>Score</th>
  102. </tr>
  103. </thead>
  104. <tbody>
  105. <tr>
  106. <td>Q1</td>
  107. <td>Do you have the Quality Unit?</td>
  108. <td id="htqf1">-</td>
  109. </tr>
  110. <tr>
  111. <td>Q2</td>
  112. <td>Apply PICS GMP?</td>
  113. <td id="htqf2">-</td>
  114. </tr>
  115. <tr>
  116. <td>Q3</td>
  117. <td>Do you have a deviation or non-conformance procedure?</td>
  118. <td id="htqf3">-</td>
  119. </tr>
  120. <tr>
  121. <td>Q4</td>
  122. <td>Do you have a customer complaint procedure?</td>
  123. <td id="htqf4">-</td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. </div>
  128.  
  129. <input type="button" onclick="fillHidTable()" value="Export Data to Excel">
  130. </body>
  131. </html>
 
 
 
read less
Comments

Adobe Certified , Microsoft Certified Trainer with 9 years of experience

If you mean an actual form in datasheet view, you can export that form's data to Excel with the DoCmd.OutputTo method. DoCmd.OutputTo acOutputForm, "frmResults", acFormatXLS, _ "C:\SomeFolder\ExportedResults.xls" However, if you're opening a query in datasheet view, rather than an actual form,...
read more

If you mean an actual form in datasheet view, you can export that form's data to Excel with the DoCmd.OutputTo method.

DoCmd.OutputTo acOutputForm, "frmResults", acFormatXLS, _
    "C:\SomeFolder\ExportedResults.xls"

However, if you're opening a query in datasheet view, rather than an actual form, you can export the query's result set.

DoCmd.OutputTo acOutputQuery, "qryResults", acFormatXLS, _
    "C:\SomeFolder\ExportedResults.xls"

You can choose a different OutputFormat instead of Excel if you wish. Look at Access' Help topic for the OutputTo method to see the available choices.

read less
Comments

Related Questions

What is VBA and what is its importance?
vba is visual basic for application. it is used to automate the task and make user define formula.
Shagufta
0 0
5

How many days it will take to complete advance excel course?

The duration to complete any kind, of course, depends on your grasping power and the ability to learn the concepts quickly. Having said that, it usually takes about three to four weeks to learn the topics...
Amit

which is the best institute or college for Power bi and AWS course with job Support in Pune location? 

Hackers University APC Learning Solutions is the best training institute for AWS & Devops, Power BI they provide training with job placements
Vk
How do I type new line inside a single cell? I don't want to go to another cell but there should be a new line inside 1 cell. Please help.
You can type Alt+Enter, in case you wanted word wrap, then goto the Home Tab, Alignment group and select Word Wrap otion
Arjun

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

VBA Function - RIGHT
RIGHT function in VBA returns the Specified number of characters from the end of a text string Syntax: Right(String,Length) Sub RIGHT_1() Dim mystring As String mystring = "Narendra Modi" MsgBox Right(mystring,...

Hidden Gems of MS Excel - Compare Year-on-Year Performance Using Pivot Table
Did You know You can Compare Year-on-Year& Performance Using Pivot Table?Yes. Just drag-&-drop and Compare Year-on-Year& Performance Quickly.& Year-on-Year simply means Periodic. As per...

HTML (Hypertext Markup Language)
HTML (Hypertext Markup Language) is the set of markup symbols or codes inserted in a file intended for display on a World Wide Web browser page. The markup tells the Web browser how to display a Web page's...

TODAY WE LEARN MAX FORMULA, HOW TO USE IT.
1 A B 2 NAME SERIES 3 Vinita 50 4 Vimlesh 34 5 Karina 73 6 Kartrina 18 7 Salman 65 8 Gold 48 =MAX(C3:C8) ANSWER- 73 =MAX(NUMBER 1, NUMBER 2)

Most important things to remember while doing VLOOKUP! (Donts..)
Make sure there are no unwanted or additional spaces in between the words or afterwards Example: Robert Smith_ Note: To show the additional spaces I have underlined the entire words. Don’t...

Recommended Articles

Microsoft Office is a very popular tool amongst students and C-Suite. Today, approximately 1.2 billion people across 140 countries use the office programme. It is used at home, schools and offices on a daily basis for organizing, handling and presenting data and information. Microsoft Office Suite offers programs that can...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Looking for Microsoft Excel Training classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Microsoft Excel Training Classes?

The best tutors for Microsoft Excel Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Microsoft Excel Training with the Best Tutors

The best Tutors for Microsoft Excel Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more