End of record in excel

Hi,
oracle db:9.0
forms 10g.
I am seeing inconsistency in finding a last record in excel. I am trying to load data from excel into a table. I am looping each row in excel until i find a last row in excel.
For finding last row, I saw a post in forums that helped me to find a last row in excel.
I used this statement to find last row in excel:
                                                    cells := CLIENT_OLE2.GET_OBJ_PROPERTY ( mysheet, 'Cells' );
                    args := CLIENT_OLE2.CREATE_ARGLIST;
                    CLIENT_OLE2.ADD_ARG ( args, 11 ); -- xlCellTypeLastCell - must specify numeric
                    lastcell := CLIENT_OLE2.INVOKE_OBJ ( cells, 'SpecialCells', args );
                    CLIENT_OLE2.DESTROY_ARGLIST ( args );
                    nResult := CLIENT_OLE2.GET_NUM_PROPERTY ( lastcell, 'Row' ); but some times it would not detect the exact end of line. it keeps on parsing empty lines even though there is no data. Could you please let me know if there is any other standard way of detecting end of line in Excel.
Thanks

Can you show an example of the data that is incorrect and an example of the data that is correct?
Is the problem with the output or the data from the query?

Similar Messages

  • Exporting A Selection of Records to Excel

    Hi All,
    This is my first ever question to a forum, so please go easy on me! I'm also very new to Access and VBA. I'm building a database that stores (in related tables): TradingName, PropertyName, and PaddockName (as well as other relevant details). I have combined
    (Joined) the data I require into a table as well as a query.
    Now I want to export the Paddocks and Properties for each client. I have been able to export all clients and Paddocks (All Records) into Excel as well as individual Client and Paddock (Individual Record). But I want to be able to export all paddocks for
    a property or a client (multiple records for a client or property).
    My code is working for both scenarios (All Records and Individual Records) above but I'd like to know how to write code to export only selected Client or Property which is selected via a combobox.
    The Code I have used seems to be typical on all forums I have visited, but none does what I want/need.
    All help Appreciated
    Thanks
    Nath
    This sub exports a SINGLE Record
    'This Sub Exports ALL Records
    Private Sub btnExportXls_Click()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    'Set db = DAO.DBEngine.Workspaces(0).OpenDatabase("C:\database.mdb")
    Set db = CurrentDb
    ' Set rs = db.OpenRecordset("MasterSummary", dbOpenSnapshot)
    Set rs = db.OpenRecordset("tblExpXlsClientPropPdkDetails", dbOpenSnapshot)
    'Start a new workbook in Excel
    Dim oApp As New Excel.Application
    Dim oBook As Excel.Workbook
    Dim oSheet As Excel.Worksheet
    Set oBook = oApp.Workbooks.Add
    Set oSheet = oBook.Worksheets(1)
    'Add the field names in row 1
    Dim i As Integer
    Dim iNumCols As Integer
    iNumCols = rs.Fields.Count
    For i = 1 To iNumCols
    oSheet.Cells(1, i).Value = rs.Fields(i - 1).Name
    Next
    'Add the data starting at cell A2
    oSheet.Range("A2").CopyFromRecordset rs
    'Format the header row as bold and autofit the columns
    With oSheet.Range("a1").Resize(1, iNumCols)
    .Font.Bold = True
    .EntireColumn.AutoFit
    End With
    oApp.Visible = True
    oApp.UserControl = True
    'Close the Database and Recordset
    rs.Close
    db.Close
    End Sub
    This Sub Exports A Single Record (Paddock) and is commented out as I trialed the other sub.
    'Private Sub btnExportXls_Click()
    '' The following Sub only exported 1 record at a time and only copied data to selected cells, it doesn't move to next free cells.
    ''Export Selected Client/Property to Excel
    ''First you must set a Reference to the Microsoft Excel XX.X Object Library
    ' Dim appExcel As Excel.Application
    ' Dim wrkBook As Excel.Workbook
    ' Set appExcel = New Excel.Application
    ' Set wrkBook = appExcel.Workbooks.Open(CurrentProject.Path & "\ClientPropertyPdkDetails.xlsx")
    ' appExcel.Visible = True 'Make Excel Window Visible
    ''Make Batch Sheet the active Worksheet
    ' wrkBook.Worksheets("Client Property Pdk").Activate
    ' With wrkBook.ActiveSheet
    ' .Range("A2").Value = Me![Client_ID]
    ' .Range("B2").Value = Me![TradingName]
    ' .Range("C2").Value = Me![Property_ID]
    ' .Range("D2").Value = Me![Property]
    ' .Range("E2").Value = Me![ID]
    ' .Range("F2").Value = Me![PaddockName]
    ' .Range("G2").Value = Me![PaddockArea]
    ' .Range("H2").Value = Me![ArablePdkArea]
    ' .Range("I2").Value = Me![MonitoredPdk]
    ' .Range("J2").Value = Me![SoilSamplePdk]
    ' .Columns("A:J").AutoFit 'Autofit Columns A thru J to hold contents
    ' End With
    ''DoCmd.OutputTo acOutputQuery, "qryClientPropertyPaddockJoined", acFormatXLSX, "K:\Dropbox\1a Graminus Consulting\Graminus Database\ClientPropertyPdkDetails.xlsx", , , acExportQualityPrint
    'End Sub

    Hi All,
    Thanks for your help and input much appreciated! I think I was in a rutt and trying to be too tricky (I think). I have since changed tact and created a Public Function (Below) that creates a temporary query and export that instead. It works a treat.
    Thanks Again
    Nath
    Public Function CreateQueryDAO()
    'Purpose: Create a query based on Clients Property Name to Export to Excel
    Dim db As DAO.Database
    Dim qdf As DAO.QueryDef
    Set db = CurrentDb()
    'The next line creates and automatically appends the QueryDef.
    Set qdf = db.CreateQueryDef("qryPropertyDetails")
    'Set the SQL property to a string representing a SQL statement.
    qdf.sql = "SELECT tblExpXlsClientPropPdkDetails.* FROM tblExpXlsClientPropPdkDetails WHERE [Property_ID] =" & Forms![frmExportClientPropertyPaddockExl].txtPropertyID
    'Do not append: QueryDef is automatically appended!
    Debug.Print "qry[qryPropertyDetails] created."
    'Start a new workbook in Excel
    Dim oApp As New Excel.Application
    Dim oBook As Excel.Workbook
    Dim oSheet As Excel.Worksheet
    Dim rs As DAO.Recordset
    Set rs = db.OpenRecordset("qryPropertyDetails", dbOpenSnapshot)
    Set oBook = oApp.Workbooks.Add
    Set oSheet = oBook.Worksheets(1)
    'Add the field names in row 1
    Dim i As Integer
    Dim iNumCols As Integer
    iNumCols = rs.Fields.Count
    For i = 1 To iNumCols
    oSheet.Cells(1, i).Value = rs.Fields(i - 1).Name
    Next
    'Add the data starting at cell A2
    oSheet.Range("A2").CopyFromRecordset rs
    'Format the header row as bold and autofit the columns
    With oSheet.Range("a1").Resize(1, iNumCols)
    .Font.Bold = True
    .EntireColumn.AutoFit
    End With
    oApp.Visible = True
    oApp.UserControl = True
    Debug.Print "Property Exported to Excel."
    'Delete new Query.
    db.QueryDefs.Delete "qryPropertyDetails"
    Debug.Print "qry[qryPropertyDetails] Deleted."
    'Close the Database and Recordset
    rs.Close
    db.Close
    Set qdf = Nothing
    Set db = Nothing
    'Source: http://allenbrowne.com/func-dao.html#CreateQueryDAO
    Private Sub btnCreateQry_Click()
    CreateQueryDAO
    End Sub
                                                 

  • How to add spaces at the end of record

    Hi Friends,
    i am creating a file which contains more than 100 records.
    In ABAP i have internal table with on field(135) type c.
    some time record have length 120, somtime 130 its vary on each record.
    but i would like to add space at the end of each record till 135 length.
    Can you please help me how to add speace at the end of record.
    regards
    Malik

    So why did you said that in your first posting? My glass sphere is out for cleaning...
    Instead of type c use strings and add spaces until they have the appropriate length.
    loop at outtab assigning <pout>.
      while strlen( <pout>-val ) < 135.
        concatenate <pout>-val `` into <pout>-val.
      endwhile.
    endloop.

  • How to supress empty records in excel

    Hi,
    I am using Oracle reports 10.1.2.0.2. The problem is with the excel output of the report. I am using DESFORMAT=SPREADSHEET to run the reorpt using rwservlet. In the excel output I am seeing blank records at places where I used format trigger in the report to hide it based on a condition. I would like to know if there is a way to supress those records in excel. There is not problem with the pdf output, in this format the blanks are supressed by default and output looks fine.
    Any suggestions would be greatly appreciated.
    Thanks

    No, I can not do that because they are all parameter based. depending on the parameter user selects different headings will be displayed on the report. All the deaders are from different columns of the table. I am using lexical parameters for this.
    Thanks

  • How to extract 250,000 Records into excel

    Hi Friends In sql server My table has 250,000 records . How can I import these records into excel?
    If not  which file type I can use for it. Thanks for advance friends

    There are many solutions. I say two solution here:
    using "extract" by right click on database in ssms like bellow screens shots
    using "get external data" from data tab in excel
    more info: http://office.microsoft.com/en-001/excel-help/connect-to-import-sql-server-data-HA010217956.aspx
    sqldevelop.wordpress.com

  • HELP!Crystal 10 -- ''Failed to open document. Read past end TSLV record.''

    I create new report using Wizard, Add Command (Oracle query).
    I see table in my report, I can run ... Then I save my report and close it.
    But when I try to open again -- I can't open again and I see error:  "Failed to open document. Read past end TSLV record."
    Please, help me ! :((((

    The following SAP Note may help you!!!!
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
    Regards,
    Raghavendra

  • Crystal 10 -- ''Failed to open document. Read past end TSLV record.''

    I create new report using Wizard, Add Command (Oracle query).
    I see table in my report, I can run ... Then I save my report and close it.
    But when I try to open again -- I can't open again and I see error:  "Failed to open document. Read past end TSLV record."
    Please, help me ! :((((

    duplicate - please do not post multiple times

  • AJAX: Junk value coming at end of records

    Hi,
    I am using ajax to populate the values in Combo box. I have an issue there.
    When i select one value in first combo, it displays junk characters at end of records.
    e.g. If on selction of A i should get 1, 2 and 3 in second drop down. I am getting 1, 2, 3, ^%^%.
    Please let me know what can be issue.
    ~Aman

    This is the JS call.
                   function fnGetBonusData2()
                   for(i=document.getElementById("bonusData2").options.length-1;i>=0;i--)
                             document.getElementById("bonusData2").remove(i);
                        var bonusData1 = document.getElementById("bonusData1").value;
                        var strURL = "../getBonusData2.do"
                        strURL = strURL+"?methodName="+"getBonusData2";
                        strURL = strURL+"&controlName="+"bonusData2";
                        strURL = strURL+"&bonusData1="+bonusData1 ;
                        fnRetrieveURL(strURL,"fnOnReturnFromBonus2");
                   }Action Method code
              try {
                   if (isValidSession(request)) {
                   String strBonusData1 = request.getParameter("bonusData1");
                   BonusDataManager bonusDataManager = new BonusDataManager();
                   String strAreaForRegion = bonusDataManager.getBonusData2(strBonusData1) ;
                   System.out.println("bonus data 2"+strAreaForRegion);
                   response.setContentType("text/html");
                  PrintWriter out = response.getWriter();
                  out.println(strAreaForRegion);
                  out.flush();
                   } else {
                        return null;
              } catch (Exception ex) {Manager method call
        public String getBonusData2(String strBonusData1)
              String value="";
              PersistencyManager persistencyMgr = new PersistencyManager();
              try {
                   persistencyMgr.beginTransaction();
                   if(!strBonusData1.equalsIgnoreCase(""))
                        StringBuffer userQueryBuffer = new StringBuffer();
                        userQueryBuffer.append("SELECT distinct bonusMaster.bonusData2 ");
                        userQueryBuffer.append("from BonusMaster bonusMaster where bonusMaster.bonusData1 ='");
                        userQueryBuffer.append(strBonusData1);
                        userQueryBuffer.append("'");
                        Collection collection = persistencyMgr.find(userQueryBuffer.toString());               
                        int counter = 0;
                        if(collection != null || collection.size() != 0)
                        for (Iterator it = collection.iterator(); it.hasNext();) {
                                  Object obj = (Object) it.next();
                                  String bonusMasterData2 = (String) obj;
                                  if(null != bonusMasterData2){
                                       if(counter != 0)
                                            value += ",";
                                       value +=bonusMasterData2;
                                       counter ++;
              }Return JS method call
                   function fnOnReturnFromBonus2()
                        if (varXMLrequest.readyState == 4)
                             if(varXMLrequest.status == 200)
                                  var strSubClassValue = varXMLrequest.responseText;
    //                              alert(strSubClassValue.length);
                                  if(strSubClassValue != '')
                                    var strArray = strSubClassValue.split(",");
    //                                   alert(strArray);
                                       var iLength = strArray.length;
    //                                   alert(iLength);
                                       var optnSelect = document.createElement("OPTION");
                                       optnSelect.text = 'Select';
                                       optnSelect.value = '';
                                       document.getElementById("bonusData2").options.add(optnSelect);
                                       for(i =0 ; i< iLength;i++)
                                            var optn = document.createElement("OPTION");
                                            optn.text = strArray;
                                            optn.value = strArray[i];
    //                                        alert(optn.value);
                                            document.getElementById("bonusData2").options.add(optn);

  • What is the best way to get the end of record from internal table?

    Hi,
    what is the best way to get the latest year and month ?
    the end of record(KD00011001H 1110 2007  11)
    Not KE00012002H, KA00012003H
    any function for MBEWH table ?
    MATNR                 BWKEY      LFGJA LFMON
    ========================================
    KE00012002H        1210             2005  12
    KE00012002H        1210             2006  12
    KA00012003H        1000             2006  12
    KD00011001H        1110             2005  12
    KD00011001H        1110             2006  12
    KD00011001H        1110             2007  05
    KD00011001H        1110             2007  08
    KD00011001H        1110             2007  09
    KD00011001H        1110             2007  10
    KD00011001H        1110             2007  11
    thank you
    dennis
    Edited by: ogawa Dennis on Jan 2, 2008 1:28 AM
    Edited by: ogawa Dennis on Jan 2, 2008 1:33 AM

    Hi dennis,
    you can try this:
    Sort <your internal_table MBEWH> BY lfgja DESCENDING lfmon DESCENDING.
    Thanks
    William Wilstroth

  • Reading records from excel

    hi all,
    i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
    i am uploading data from excel to form(record wise)and saving.
    now i am reading the data from 2nd row by assuming that 1st row followed with columns titles.But, my question is we cannot predict the excel that the record always starts from 2nd row. how check for the starting for the actual data
    is its something like if column1 is null and col2 is null and col3 is null
    then increment the row and repeat the process.. but, upto which record i should continue this process..
    anybody is having better solution than this..
    Thanks..

    Hi,
    The nice option would be keep the upload (start from and end) manually, What i mean is in the uploading screen put two more fields like Start Row and End Row and let the user fill these fields before starting the upload process. So, if any error will happen during upload then let the user handle.
    -Ammad

  • IE taking a lot of time in rendering records to EXcel-Help!!

    Hello,
    My application is a web application and uses JSP and WebSphere server.
    There is a functionality when a button is pressed the page sends the request to server and the search result is shown in a spreadsheet(excel file).
    Now when we use Mozilla browser it gives the results in 5-6 seconds for some hundred records. when we use IE it takes several minutes for the same search.
    Is there some kind of setting that needs to be altered?
    please help

    Hi Nilaksha,
    actually,its a QC form,where the end user is giving values for an item which has 10 sublots,he his passing the values for 10 sublots(no,sample,quantity,uom,date).
    The table is QC_SMPL_MST where he has taken the base table common for different data blocks.
    No i am not using any pre-commit statements,using the database information for retieving the item_no and sub_lots

  • Unable to read E$ table records into excel file in linux machine

    Hi
    I am using below code in ODI procedure to read E$ table record and store it in excel file
    ODI Procedure: Technology=Java Beanshall and Command on Target I written below code and placed it in CKM Oracle KM
    <@
    String OS = System.getProperty("os.name").toLowerCase();
    String v_path="";
    if((OS.indexOf("win") >= 0))
    v_path="D:\Unload_Dir\<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("mac") >= 0)
    v_path="path details";
    else if (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 )
    v_path="/odi_a/oracle/Middleware/logs/wcds/odi_logs/<%=snpRef.getSession("SESS_NO")%>.xlsx";
    else if (OS.indexOf("sunos") >= 0)
    v_path="soliaris path";
    @>
    OdiSqlUnload "-FILE=<@=v_path@>" "-DRIVER=<%=odiRef.getInfo("DEST_JAVA_DRIVER")%>" "-URL=<%=odiRef.getInfo("DEST_JAVA_URL")%>" "-USER=<%=odiRef.getInfo("DEST_USER_NAME")%>" "-PASS=<%=odiRef.getInfo("DEST_ENCODED_PASS")%>" "-FILE_FORMAT=VARIABLE" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=ISO8859_1" "-XML_CHARSET_ENCODING=ISO-8859-1"
    select * from <%=odiRef.getTable("L","ERR_NAME", "W")%>
    But is not reading the data into .xlsx file ,
    Please help me it is very urgent
    Can I use below code
    String os = "";
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
    os = "windows";
    } else if (System.getProperty("os.name").toLowerCase().indexOf("linux") > -1) {
    os = "linux";
    } else if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) {
    os = "mac";
    T
    his is high priority, please help me urgent
    Regards,
    Phanikanth
    Edited by: Phanikanth on Feb 28, 2013 5:43 AM
    Edited by: Phanikanth on Feb 28, 2013 6:00 AM
    Edited by: Phanikanth on Feb 28, 2013 7:42 AM

    Hi,
    can you describe what is happening when you run the ODI procedure described below:
    - Does the procedure fail with an error, if yes, which error(full details)?
    - Does the procedure pass but no xslx file is been created?
    - Does the procedure pass and an xslx file is been created, but Excel can't read it? If yes, what is the structure of the xslx file when read in an editor?
    What I can see from your code below is that you have choosen -FILE_FORMAT=VARIABLE, but the XSLX format is supposed to be XML.
    Regards,
    Alex

  • Adobe Acrobat 5.0 Set End of Record or Record Break

    I have used a plug in (XMPie) to InDesign to generate a 4 page variable document. This document contains multiple records. I have created a PDF output a file containing 800 pages. The problem is, I need to be able to define where the end of each record is so that I can properly collate and staple each record (4 pages) separately. Is there a way to do this in Acrobat?

    Adobe proior to version 9 discouraged multiple Acrobat/Reader product/versions on the same client. Version 9 says it is OK but you still need to set each applications preferences correct to stop the sibling bickering. Too many posts about this.

  • Download records to EXCEL file with  Leading Zero's for numbers

    Hi All,
    I am able to download the data to EXCEL file on the presentation server.
    There are few fields (Plant,SalesOrder Number ..with Leading Zero's) in the record.
    These values are downloaded with out Leading Zero's to excel( EX: 0000004122 as 4122).
    Please help me to download the data to EXCEL file with leading zero's.
    Thanks and Regards,
    KC

    >
    Krishna Chaitanya  G wrote:
    > The excel file which is to be downloaded..will be used by some other program..to upload the values to the sap.
    > It matters there....
    > KC
    HI KC,
    then no need to download the zeros,
    after uploading, loop at that uploaded internal table and use CONVERSION_EXIT_APLHA_INPUT and pass the vbeln(without zeros) to this FM, it will return the value with added zeros.
    hope this solves your query
    a small example
    Loop at itab into is.
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    INPUT = is-vbeln "(  this is without zeros)
    IMPORTING
    OUTPUT = is-vbeln. "( this is with leading zeros)
    modify itab from is.
    endloop.
    Edited by: Soumyaprakash Mishra on Oct 6, 2009 2:16 AM

  • Report is showing dupilcate records in Excel and correct records in PDF.

    Hi,
    I have a problem, when i run the query of report in toad then count is 24 and same records are coming in PDF, RTF and HTML format but some duplicate records come when same report is run in excel or delimited format.

    This is bcoz you don't have all the common fields in your infocubes.
    Job is the only filed common in the infocube.
    Some Characteristics like project is only available in one Cube, similarly and qualification field is only available in other Cube.
    If a Multiprovider is created on top of these two infocubes. Common chars are identified from both cubes; others can be identified only from the respective cubes.
    When we build a query on this Multiprovider, keeping a char which is not part of both cubes will create an other line with # or NA values present in that column.
    In the query designer create a new selection on the KF.
    Inside that, maintain description and drag the keyfigure from left pane to selection pane, drag characteristic "jobu201D into the selection. In the context menu of job, choose u201Cconstant selectionu201D option.
    repeat the same for all the KFs.
    for more details chk the below link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70dcd7b5-6a3d-2d10-c984-e835e37071a2?quicklink=index&overridelayout=true
    Regards
    KP

Maybe you are looking for

  • Creation of Appointment letter

    Hi to all.. I have to Create Appointment letter for HR.For that I have Created Infotype 9001 and Standard Object for Appintment letter.But i m not getting how to use that infotypes and Standard object in Smartform for displaying that letter, i have c

  • Exchange 2010 embedded images in email problem

    We have Exchange 2010 and the limit on our global settings and various send/receive connectors is 30720 KB everywhere for Max receive size & max send size.  Currently, even if the message size is well below the KB limit, if there are enough images em

  • Microsoft is blocking emails - sending delist option but never responds

    Microsoft is blocking our emails for no reason. I have clicked on the delist option to voice my concern and get a lame message back that says someone will contact me within 24 hrs well its been several delist requests and well over 72 hours later and

  • During typing sporadically keys do not respond immediately.

    Sometimes (not constant) when typing, the key does not respond immediately. If I wait 15-30 sec. Then it responds as we'll as additional keys I may have tapped. Also when attempting to save an email to a specific folder, I tap the "save" icon then in

  • Summary column get less

    Hi, I have a formula column in group G1, which returns either 0 or 1, and there is summary column calculates the sum of this formula column on report level. it seems that the summary column doesn't count the first row which means I always get the sum