Export specific Excel cells to Access
Hi,
I'm putting together a submission form in excel which will update a database in access.
I'm currently trying to use a macro on the submit button to do it but and while i understand the majority of it im not sure how to establish the connection through the macro.
Essentially im a VBA n00b and haven't completed a project like this before now.
So i guess my question is how would i go about establishing this through an excel based Macro?
This is my code for submitting the data into Access
rs.Open Sql, cn, adOpenDynamic, adLockOptimistic
With rs
.AddNew
.Fields("Date").Value = Trim(Cells(50, 1).Text)
.Fields("Agent").Value = Trim(Cells(50, 2).Text)
.Fields("Request").Value = Trim(Cells(50, 3).Text)
.Fields("Date1").Value = Trim(Cells(50, 4).Text)
.Fields("Date2").Value = Trim(Cells(50, 5).Text)
.Fields("Start").Value = Trim(Cells(50, 6).Text)
.Fields("End").Value = Format(Cells(50, 7).Value, "hh:mm")
.Fields("RDO").Value = Trim(Cells(50, 8).Text)
.Fields("Call Type").Value = Trim(Cells(50, 9).Text)
.Update
End With
If rs.State = adStateOpen Then rs.Close
If cn.State = adStateOpen Then cn.Close
Set rs = Nothing
Set cn = Nothing
MsgBox "Your request has been submitted." & vbNewLine & vbNewLine & "Thanks...", vbOKOnly, "John Smith"
On Error Resume Next
Call Email
Range("e11:e18").ClearContents
End Sub
But what needs to go before it to establish the connection?
Also how would i find any SQL addresses required for the connection to be made?
Please help!
Hello,
Please see the examples on the resources below:
http://msdn.microsoft.com/en-us/library/office/aa195812(v=office.11).aspx
http://www.access-programmers.co.uk/forums/showthread.php?t=199575
I believe the following forum is more appropriate to place your question. If you agree, let me know to move the question to that forum.
http://social.msdn.microsoft.com/Forums/en-US/home?forum=isvvba
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com
Similar Messages
-
OBIEE 11.1.1.6.7 export to excel - cells not suppressing
When exporting a table to Excel, cells are repeating in the excel report, despite the fact that these columns are set to "Suppress" in Column Format.
The values are suppressed in the table on the dashboard, the values are suppressed when we export to PDF, but when we export to Excel suppression is not working.
We have another report where suppression is working fine when exporting to excel so it does not seem to be due to which excel version we are using.
The suppression in excel worked fine in 10g for this report, and when we migrated to 11g, that is when it stopped working.
When comparing the two different reports, we can't find any difference in properties that could affect the suppression.
Any ideas on what we can do to fix this?
Best Regards
Joel
Edited by: joel_s on May 10, 2013 1:56 PMHi,
This is a known issue.
To my knowledge, not solved...
Check document 1535547.1.
Regards. -
Text Hyperlink from PDF (converted Word doc) to specific Excel cell in same Portfolio
Good Morning,
I have created a Word document with an embedded Excel sheet (both Office 2007) and created a text hyperlink within the document that points to a specific cell on a specific tab. My company wants to send our document to a customer, but will only send PDFs. When converting to PDF the hyperlink does not work any longer.
To make the behaviour in Word one must open the embedded Excel object to the specific sheet and then copy the specific cell in question. In Word choose Paste as Hyperlink. Press Alt+F9 and then change HYPERLINK to hyperLINK. Press Alt+F9. Edit the Settings of the Hyperlink and change the Text to Display.
Is there a way to do this with Acrobat 10? The plus side would be that the Excel document would not be embedded in Word although it would still need the Document ID of the Excel file in the portfolio. Futhermore, the Word document won't be included in the portfolio.While Acrobat cannot pass opening parameters to non-PDF files it can do so for PDF (under specific circumstances).
See the "Parameters for Opening PDF Files" document at:
http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open _parameters_v9.pdf
Be well... -
Writing to specific excel cells
Hello,
Is it possible to write to an EXISTING file to one specified cell? I have tried using write to xl.vi as an example, but this rewites the entire file and I lose my old data.
I would greately appreciate any advice!
Thank-you,
IvankaIbahka,
Take a look at the modified example. I show how to open an existing File and sheet. From your post I am not sure if you got that far or not.
Anyways you can then use Set Cell Value.vi SubVI to set the value of an 1 cell in the file and worksheet you just opened.
The example does that in a loop, thus re-writes all the data. However if you only want to set 1 cell, take the VI out of the loop, and use it independantly.
See how I changed the 0,0 cell after all the data is set.
Attachments:
Write_Table_To_XL.llb 156 KB -
Hi,
How can I read a specific excel cell via Web Dynpro ?
It will be great if someone will provide a short sample of code for that ...
10x in advance
HadarHi Chandran i followed you steps regarding to upload excel sheet data to webdynpro table.
but iam not get clarity how to do this step.
Note : You cannot Read the Content from the excel file directly
First You Have to copy that file to the Server,
And from the Server you can get the file absolute path
With the absolute path you can read the contents of the Excel file
You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
help me onthis step, i need to develop the this feature in application.
you posted like this
Hi
First You have to download the jxl.jar file. You can get this file from the Below site
JExcelApi v2.6.4 (1747kbytes)
It will be in Compressed Fromat So Unzip it to get the Contents
After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
You will get window displaying your Project Properties
On Left Side of the window You Will Find "Java Build Path"
Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
Click Libraries Tab
You will find options many options buttons
In that click the Button "Add External Jars"
You will get Window in order to fecth the jxl.jar file from the location you had stored
After selecting the jxl.jar i will get displayed and click ok
Now Open Navigator
Open Your Project
You will find Lib folder
Copy the jxl.jar to that lib folder
Note : You cannot Read the Content from the excel file directly
First You Have to copy that file to the Server,
And from the Server you can get the file absolute path
With the absolute path you can read the contents of the Excel file
You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
You have Upload the Excel file from the Server Using the File Upload UI Element
This Coding will extract 3 columns from the Xls File
Coding
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import com.sap.fileupload.wdp.IPrivateFileUpload_View;
import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File(ServerEvent)
IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
IWDResource resource = element1.getFileResource();
element1.setFileName(resource.getResourceName());
element1.setFileExtension(resource.getResourceType().getFileExtension());
//@@end
public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_File_in_Server(ServerEvent)
InputStream text=null;
int temp=0;
try
File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
FileOutputStream op = new FileOutputStream(file);
if(wdContext.currentContextElement().getFileResource()!=null)
text=wdContext.currentContextElement().getFileResource().read(false);
while((temp=text.read())!=-1)
op.write(temp);
op.flush();
op.close();
path = file.getAbsolutePath();
wdComponentAPI.getMessageManager().reportSuccess(path);
catch(Exception e)
e.printStackTrace();
//@@end
public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionUpload_Data_into_Table(ServerEvent)
try
Workbook wb =Workbook.getWorkbook(new File(path));
Sheet sh = wb.getSheet(0);
//wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
//wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
int columns = sh.getColumns();
int rows = sh.getRows();
int i=0;
for(int j=1;j<=rows;j++)
ele=wdContext.nodeTable_Data().createTable_DataElement();
Cell c1 = sh.getCell(i,j);
ele.setTab_Name(c1.getContents());
Cell c2 = sh.getCell(i+1,j);
ele.setTab_Degree(c2.getContents());
Cell c3 = sh.getCell(i+2,j);
ele.setTab_Percentage(c3.getContents());
wdContext.nodeTable_Data().addElement(ele);
catch(Exception ex)
wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
//@@end
The following code section can be used for any Java code that is
not to be visible to other controllers/views or that contains constructs
currently not supported directly by Web Dynpro (such as inner classes or
member variables etc.). </p>
Note: The content of this section is in no way managed/controlled
by the Web Dynpro Designtime or the Web Dynpro Runtime.
//@@begin others
String path;
IPrivateFileUpload_View.ITable_DataElement ele;
//@@end
Regards
Chandran S -
Excel export are merging cells for data on multiple lines !
Hello,
I'm using Crystal Report XI R2, when we are doing an export to Excel with have an unexpected formatting.
For example the value of the name is on 2 lines:
=> So, on Excel the result is on 2 lines but merged. We want to have this result only on one cells.
Remark: if we delete the 2nd lines, because cells are merged we obtain the expected result.
Proposal A:
Are they any set-up available concerning the formatting of Excel ?
Proposal B:
Could we run some VBA when we click on Export button to make queries on the Excel ?When they introduced Unicode support in Crystal 9 (I believe), they had to completely re-write the export routines. At that time, they made a decision to change the functionality of the excel export. Crystal is attempting to remain absolutely faithful to the graphical layout of the report as you see it in the viewer. So it creates merged cell sections, empty columns between columns, and empty rows to give you as close to exactly what you see in the viewer as possible. Unfortunately, the result is typically less than useful. Iu2019ve had several conversations with Business Objects (now SAP) with regards to this when they changed it between versions 8.5 and 10, and they have no intention of changing the functionality as it now exists.
There is a document which is now likely somewhere on the SAP portal that explains what you need to do to obtain the best results when exporting to excel.
The jist of it is this:
Line up all of the columns detail data with thier headers, and make sure that data fields are the same size as thier headers.
Line up all rows (headers and detail rows). (ie: select everything in the row, right click, align tops, and make the same height)
cram everything as close together as possible. zero space in the report translates to zero extra collumns and rows in the export.
the other option is to use the export to data only functionality, but that may not be what you're looking for either. -
Export to excel with formatting was autowrapping text in a cell
Export to excel with formatting was autowrapping text in a cell without having to check the can grow option. When the can grow option is checked it does wrap the text however it spans multiple rows, which causes complications when trying to sort.
It worked in:
ProductVersion=10.0.0.533
ProductName=Crystal Enterprise 10 Embedded
Doesnt work in:
Crystal Reports 10.0 Service Pack 6
After the upgrade the reports did not autowrap, b/c the "can grow" option was not checked. I believe this was fixed by "ADAPT00305137 Patch ID: 36479914
Description:
When users export to Excel 97-2000 with the page-based format, text fields are wrapped, even when the "can grow" feature in the
Designer is turned off." . After we turn the option to grow on it does wrap however it spans across multiple rows. So I guess my question is there a way for it not to span multiple rows when wrapping text?
Edited by: dforde on Jan 27, 2010 11:12 PMI could be wrong, but I believe the export to excel option exports the database values, and the export to HTML exports the values seen in the sheets. If the database values are stored as seconds, the Excel will see them as seconds, and the data will have to be formatted properly in Excel.
I haven't toyed around with Excel exports that much, but it might be possible to set up a template or macro in excel that would have the proper formatting, and use it when opening the Disco export. -
How to format the font in Cell when export to Excel file?
Dear all,
I am using the CRJ SDK 12 to export to Excel file, but i i want to format the font of Cells in Excel when exporting them.
Can you help me to solve this issue?
Thanks,
NhaThere's no control over per-cell formatting for Excel exports.
Sincerely,
Ted Ueda -
ALV with colored cell exporting to Excel
Hi all,
I have an ALV-Table in my webdynpro appliation. There are some dropdownbykey fields in the alv and some cells are colored.
After export to excel the colored cells are no more colored.
Is there a possibility to export the color too.
Best regards
MarcusHave you found a solution to this issue? I am searching for the same.
-
HFM Report export to Excel changes cell category
Greetings,
we just updgrated to version 11.1.2.2 and are noticing some strange behavior coming out of an some HFM reports we are exporting to Excel.
We are trying to sum up some values and are getting #VALUE!. We have to manually change the category settings of all columns in order to enable any Excel formulas. This occurs when values are "-".
We can manually change Excel to reflect the cells to be numbers but there are a lot of reports to change, and on top of this, the prior version of HFM/Reports did not display that issue.
Pls let me know how to resolve this issue.. Many thanks.Issue is not with HFM, but with FR Studio and version 11.1.2.2.302. Patch is available.
Patch # 16088101 -- FR 11.1.2.2.303 -
Currency cell format does not export to excel doc
Hi
i am using new numbers on my macbook also on new OSX mavrics
i have a invoice template that i have used for a good few years
it has a fair amount of formulas and cell formats running
the company i contract to uses windows based (office) system so i save the spreadsheet as an exel compatible file to send to them no problems
untill now
when i export to excel in ether .xls or .xlsx and open the document ether in numbers or on a windows pc on office 2007 all of the currency related cells are changed to 5 digits eg -£8295.00 instead of £25 and the cell format show custom
if i higlight the cell and change to curency the entrys chnge to the correct value
has any one witnessed this ?
it also is the same saving an excel sheet as a mac format CSV file and open that in numbers
please helpI am having exactly the same problem. Need to send invoices for work. Desperate for someone to help with a solution!!! thanks Stuart
-
Access Report exporting to Excel Horizontally
I've got a rather large report in Access, based on a couple of forms.
When i preview it looks fine, Textboxes are all in order with the make and model then the data in text boxes in a column below.
There are 7 columns of text boxes like this.
When I export to a PDF, it's in the right format, 7 columns next to each other.
When I export to Word and even a text file it works fine.
When I export to Excel, they all go horizontal...textbox name in row 1 and all the data in row 2, clear to column IV and that's it.
What am I doing wrong?
Thank you for any help.
GeeHi Gee,
According to the desription, when the report exported to Excel, the layout is incorrect.
Based on my test, the Access doesn't export the textbox into Excel, it just export the data in the report. Here are the test steps for your reference:
1. Create a table with some fields in Access 2013
2. Create a reprot based on the table by default
3. Export the report to Excel by External data->Export->Excel
Did I misunderstood? Also a demo database to help us reproduce this issue is much appreciate.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Jasper Export to excel: changing background color of the cell/field
Hi all,
I have designed a report containing a set of 5 different fields. All these are STRING values.
Among these are two fields named: BUDGETED and ACTUAL.
I want to show the data corresponding to ACTUAL in red color if the value of ACTUAL is greater than BUDGETED when exported in excel format.
The value itself should be displayed in red color or the excel cell should have a color red
Can someone please help me in this? How can we implement the logic to compare these two values?
Thanks in advance.You are using Jasper and you thought: hey, let me post a question in the Oracle Reports forum?
-
When exporting reports from access to excel the =sum() (group and total sums) text boxes all have the text box name prefixed to them in excel. They look good in access reports. Any way to turn this off? Why is this happening?
I've seen the same issue on 2 computers running Access 2010. I also tried this in access 2013 and had the same issue.
See the images below as examples, the first is from access, the second is the report exported to excel.
Access 2010 (http://i.stack.imgur.com/4roFM.png)
Exported report viewed in Excel 2010 (http://i.stack.imgur.com/6B1zj.png)I've seen the same issue on 2 computers running Access 2010. I also tried this in access 2013 and had the same issue.
Hi Scott,
Did you use the same database file? May I know how did you create the report and those TextBoxes?
I couldn't reproduce your problem, this is what I did:
Create a sample table and the corresponding report. Group it by one of the field, then give it a footer section. In the footer section I inserted a TextBox and set the ControlSource property to "=Sum([fieldname])". But the name of the TextBox didn't
show in the exported Excel file. Check the screenshots here:
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to export long formatted text from SAP to an excel Cell
I have created an object(ZMM_TXT_PD) and an ID(Y01) using se75 transaction.
With a Z program a store some lines in STXH table with object ZMM_TXT_PD and ID Y01.
These texts are very long and formmated.
Now I need another Z program in order to download all the stored texts in an excel file.
I have a program which is able to download an internal table to an excel. The problem is that
it only works with short texts. How could I download a long text that I get using READ_TEXT function
into an excel cell?
READ_TEXT returns an internal table like this:
i_tline TYPE STANDARD TABLE OF tline.
Thanks in advance.Hi,
Use the following link for exporting formatted data into excel
http://saptechsolutions.blogspot.com/2012/01/send-email-of-xml-format-data-as-excel.html
Maybe you are looking for
-
How can i get a replacement install dvd
Just acquired a used G4, with no disks. Want to perform a fresh install to wipe out all old data.
-
I would like to upgrade my reader at no cost
I would like to upgrade my reader at no cost. I have 7.0 currently and wtih that version I am not able to open some things
-
How do i create *if (Key.isDown(Key.LEFT)* allow two buttons
I got this code if (Key.isDown(Key.LEFT) && Math.abs(this["speed"+who])>0.3) { _root["car"+who]._rotation -= _root.rotationStep2*(this["speed"+who]/_root.maxSpeed); How do i allow it to have SPACE key and LEFT you probably knew it wouldn't work but i
-
Since quite a while (several months) I have a problem with unvoluntairy programchanges in Logic Pro. It is very hard to determine what is going on, but I'll try to discribe it... Sometimes, for no apperent reason and completely unpredictable, Logic P
-
hi what is the solution,when master data is sent to cube with out check marking ignore duplecate data records at infopackage level. thanks in advance.... points will be assigned