Last row in VB. How?

Sorry,
I know BW but I'm new at VB.
How can I get the number of rows for result area?
numRows = resultArea.Rows  gives error
numRows = resultAreas.Rows.Value ??
Please, I think it should be so easy, but I have no idea.
Thanks

Hi Oscar & Joe,
Joe is correct IF there is a range NAMED "resultArea".  But, there is not such a range unless you have already created it.
Oscar, your question is answered in this message:
Re: Comparing two queries with VBA macro
- Pete

Similar Messages

  • How to get the last row in a resultset or query

    Hi All
    Say If I have a complex query which returns a resultset say 15 rows. Now I want to limit the output showing only the last row.
    How can we do this

    Keep in mind Oracle does not keep "row" order as such. Unlike a graphical type db like Access, Oracle will not always give you back the results in order.
    Even if you were to use a sequence, your query is never guaranteed to give back the results in the order you are expecting. You must then give an order by statement to all queries expecting the order.
    Your definition of last row too is vague - if it is in fact the greatest amount, use the inline view suggestion. If you simply want to see the last inserted row, consider adding a last_update_date column inserting the sysdate (by a trigger perhaps). This would then allow you to see the last inserted row.
    Enjoy!

  • How to get the last row of a database table.

    HI ,
    I want to get record exactly from the last row of a database table.
    How is that possible?

    Hi,
    To fetch last record from an internal table, just do find the number of records in it and read using index.
    DESCRIBE TABLE ITAB LINES L_LINES.
    READ TABLE ITAB INDEX L_LINES.
    You can also use LOOP .. ENDLOOP but the above method is better (performance wise).
    using LOOP .. ENDLOOP.
    LOOP AT ITAB.
    **do nothing
    ENDLOOP.
    **process ITAB (Header record of ITAB).
    **after ENLOOP, ITAB will have the last record of the internal table.
    [here ITAB is internal table as well as header record.]
    But what is the requirement?
    If you are looking for the current record of an employee then you can use ENDDA = HIGH_DATE.
    My advice is to review your requirement again and try to fetch only that record which you need.
    Mubeen

  • How do I create a new row on tab out of the last column, last row?

    JDev 11.1.2.1.0.
    I've seen a few topics on this but none that I think were really very good solutions.
    Use Case:
    On tab out of the last column in the last row, a new row should be added to the end of the table. Bonus points for setting the focus to the first <af:inputText> of the newly created row.
    Complications:
    1. I'm having a heck of a time trying to find a function that returns the column's displayed index. Sadly, <column binding>.getDisplayIndex() returns -1 unless the user has manually re-ordered the column.
    2. Value Change Listeners only fire if there is a value change. Guess that means I need to do client/server listeners to check each and every <af:inputText> for a tab press?
    3. I'm not even going to get into setting the focus. With all the templates, regions, etc. going on, it's dang near impossible.
    Any ideas on how to attack this one?
    Will

    Hi,
    You will need to use the Run Engine Installation Wizard found on the Tools menu. In addition you need to create a installation set for the operator interface.
    Look at Chapter 16 Distrubuting TestStand ( chapter 17 for version 2).
    Once you have created your installation, install is on your new system.
    The serial number etc is part of the process model. When you run the entry point 'Test UUTs' the PreUUT callback is executed which asks the user for the serial number.
    Hope this helps
    Ray Farmer
    Regards
    Ray Farmer

  • HELP! How te retrieve the last row in MYSQL database using Servlet!

    Hi ,
    I am new servlets. I am trying to retireve the last row id inserted using the servlet.
    Could someone show me a working sample code on how to retrieve the last record inserted?
    Thanks
    MY CODE
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class demo_gr extends HttpServlet {
    //***** Servlet access to data base
    public void doPost (HttpServletRequest req, HttpServletResponse resp)
         throws ServletException, IOException
         String url = "jdbc:mysql://sql2.njit.edu/ki3_proj";
              String param1 = req.getParameter("param1");
              PrintWriter out = resp.getWriter();
              resp.setContentType("text/html");
              String semail, sfname, slname, rfname, rlname, remail, message;
              int cardType;
              sfname = req.getParameter("sfname");
              slname = req.getParameter("slname");
              rfname = req.getParameter("rfname");
              rlname = req.getParameter("rlname");
              semail = req.getParameter("semail");
              remail = req.getParameter("remail");
              message = req.getParameter("message");
              //cardType = req.getParameter("cardType");
              cardType = Integer.parseInt(req.getParameter("cardType"));
              out.println(" param1 " + param1 + "\n");
         String query = "SELECT * FROM greeting_db "
    + "WHERE id =" + param1 + "";
              String query2 ="INSERT INTO greeting_db (sfname, slname ,semail , rfname , rlname , remail , message , cardType ,sentdate ,vieweddate) values('";
              query2 = query2 + sfname +"','"+ slname + "','"+ semail + "','"+ rfname + "','"+ rlname + "','"+ remail + "','"+ message + "','"+ cardType + "',NOW(),NOW())";
              //out.println(" query2 " + query2 + "\n");
              if (semail.equals("") || sfname.equals("") ||
              slname.equals("") || rfname.equals("") ||
              rlname.equals("") || remail.equals("") ||
              message.equals(""))
                        out.println("<h3> Please Click the back button and fill in <b>all</b> fields</h3>");
                        out.close();
                        return;
              String title = "Your Card Has Been Sent";
              out.println("<BODY>\n" +
    "<H1 ALIGN=CENTER>" + title + "</H1>\n" );
                   out.println("\n" +
    "\n" +
    " From  " + sfname + ", " + slname + "\n <br> To  "
                                            + rfname + ", " + rlname + "\n <br>Receiver Email  " + remail + "\n<br> Your Message "
                                            + message + "\n<br> <br> :");
                   if (cardType ==1)
                        out.println("<IMG SRC=/WEB-INF/images/bentley.jpg>");
                   else if(cardType ==2) {
                        out.println("<IMG SRC=/WEB-INF/images/Bugatti.jpg>");
                   else if(cardType ==3) {
                        out.println(" <IMG SRC=/WEB-INF/images/castle.jpg>");
    else if(cardType ==4) {
                        out.println(" <IMG SRC=/WEB-INF/images/motocross.jpg>");
    else if(cardType ==5) {
                        out.println(" <IMG SRC=/WEB-INF/images/Mustang.jpg>");
    else if(cardType ==6) {
                        out.println("<IMG SRC=/WEB-INF/images/Mustang.jpg>");
    out.println("</BODY></HTML>");
         try {
              Class.forName ("com.mysql.jdbc.Driver");
              Connection con = DriverManager.getConnection
              ( url, "*****", "******" );
    Statement stmt = con.createStatement ();
                   stmt.execute (query2);
                   //String query3 = "SELECT LAST_INSERT_ID()";
                   //ResultSet rs = stmt.executeQuery (query3);
                   //int questionID = rs.getInt(1);
                   System.out.println("Total rows:"+questionID);
    stmt.close();
    con.close();
    } // end try
    catch (SQLException ex) {
              //PrintWriter out = resp.getWriter();
         resp.setContentType("text/html");
              while (ex != null) { 
         out.println ("SQL Exception: " + ex.getMessage ());
         ex = ex.getNextException ();
    } // end while
    } // end catch SQLException
    catch (java.lang.Exception ex) {
         //PrintWriter out = resp.getWriter();
              resp.setContentType("text/html");     
              out.println ("Exception: " + ex.getMessage ());
    } // end doGet
    private void printResultSet ( HttpServletResponse resp, ResultSet rs )
    throws SQLException {
    try {
              PrintWriter out = resp.getWriter();
         out.println("<html>");
         out.println("<head><title>jbs jdbc/mysql servlet</title></head>");
         out.println("<body>");
         out.println("<center><font color=AA0000>");
         out.println("<table border='1'>");
         int numCols = rs.getMetaData().getColumnCount ();
    while ( rs.next() ) {
              out.println("<tr>");
         for (int i=1; i<=numCols; i++) {
    out.print("<td>" + rs.getString(i) + "</td>" );
    } // end for
    out.println("</tr>");
    } // end while
         out.println("</table>");
         out.println("</font></center>");
         out.println("</body>");
         out.println("</html>");
         out.close();
         } // end try
    catch ( IOException except) {
    } // end catch
    } // end returnHTML
    } // end jbsJDBCServlet

    I dont know what table names and fields you have but
    say you have a table called XYZ which has a primary
    key field called keyID.
    So in order to get the last row inserted, you could
    do something like
    Select *
    from XYZ
    where keyID = (Select MAX(keyID) from XYZ);
    Good Luckwhat gubloo said is correct ...But this is all in MS SQL Server I don't know the syntax and key words in MYSQL
    This works fine if the emp_id is incremental and of type integer
    Query:
    select      *
    from      employee e,  (select max(emp_id) as emp_id from employee) z
    where      e.emp_id = z.emp_id
    or
    select top 1 * from employee order by emp_id descUday

  • How to display the last row in a table

    I have a table that is constantly updating, and I always want to see the last row. How can I get my table to auto scroll?

    Hi žabić,
    there is a property called "top left visible row". You can use it to scroll your table.
    edit:
    Maybe this is not the exact name, but you can see an example here
    Mike
    Message Edited by MikeS81 on 05-27-2010 03:57 PM

  • How to display a empty (non-existing) column and info in LAST row

    Hello!
    I´m trying to create the code that diplays all authors (author.name), empty COLUMN, NR_OF_BOOK_PER_AUTHOR.
    I want the LAST ROW to display: (column1) the word 'Sum:', (column2) nr of authors, (column3) total sum of all books
    Headache: How do I display the EMPTY column and how do I get the LAST ROW to display column1) 'Sum:', (column2) nr of authors, (column3) total sum of all books
    It should look like this:
    AUTHOR EMPTY NR_OF_BOOKS_PER_AUTHOR
    I can list all authors and NR_OF_BOOKS_PER_AUTHOR using this code:
    SELECT A.NAME, COUNT(B.ROWID)
    FROM AUTHOR A, BOOK B
    WHERE B.AUTHOR_ID = A.ID
    GROUP BY A.NAME
    ORDER BY COUNT(B.ROWID)
    I can count the numbers of authors (should be displayed in last row column2) using:
    SELECT COUNT(name)
    FROM author
    and I can list the total amount of books (should be displayed in last row column3) using:
    SELECT COUNT(title)
    FROM book
    But I come up short with how to display the EMPTY column and the last row containing (column1) the word 'Sum:', (column2) nr of authors, (column3) total sum of all books
    Any suggestions?
    Best regards,
    Daniel

    I want the LAST ROW to display: (column1) the word 'Sum:', (column2) nr of authors, (column3) total sum of all booksHave a look at GROUP BY with CUBE or ROLLUP.
    Cheers, APC

  • How to set focus on the last row of JTextPane

    how to set focus on the last row of JTextPane?
    import javax.swing.*;
    import javax.swing.text.html.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MyGUITest extends JPanel implements ActionListener
    {   public static void main(String[] args)
        {   SwingUtilities.invokeLater(new Runnable()
             {   public void run()
              {    JFrame f = new JFrame("My GUI");
                  MyGUITest GUI = new MyGUITest();
                  GUI.setOpaque(true);
                  f.setContentPane(GUI);
                  f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                  f.pack();
                  f.setLocationRelativeTo(null);
                  f.setVisible(true);
        JTextPane txtP;
        JButton add;
        HTMLEditorKit hek;
        HTMLDocument hd;
        String txt;
        MyGUITest()
        {     this.setLayout(new BorderLayout());
         this.setPreferredSize(new Dimension(400,200));
         txtP = new JTextPane();
         txtP.setEditable(false);
         txtP.setContentType("text/html");
         txtP.setText("");
         hek = new HTMLEditorKit();
         txtP.setEditorKit(hek);
         hd = new HTMLDocument();
         txtP.setDocument(hd);
         JScrollPane sTxtA = new JScrollPane(txtP);
         add = new JButton("add");
         add.addActionListener(this);
         sTxtA.setBorder(BorderFactory.createTitledBorder(""));
         this.add(sTxtA, BorderLayout.CENTER);
         add(add, BorderLayout.SOUTH);
         new Thread(new Runnable()
         {   public void run()
             {   while(true)
              {   try
                  {     Thread.sleep(100);
                  }catch(InterruptedException ex)
                  {     ex.printStackTrace();
                  appendText("This is <b>HTML</b> text");
                  //add.doClick();
         }).start();
        public void actionPerformed(ActionEvent e)
        {     txt = "<b>asd</b>";
         try
         {   hek.insertHTML(hd, hd.getLength(), txt, 0, 0, null);
         }catch(Exception ex){   ex.printStackTrace();   }
        public void appendText(String txt)
        {     try
         {   hek.insertHTML(hd, hd.getLength(), txt, 0, 0, null);
         }catch(Exception ex){   ex.printStackTrace();   }
    }thanks~

    anIdiot wrote:
    im not sure what is the caret location...So don't youthink you should have looked for it in the API?
    anyway, i want the scroll bar to scrolled down automatically when the output is displayed.
    normally, the scroll bar is scrolled down automatically when a new text is inserted, but it doesnt work on this timeGo through camockr's http://tips4java.wordpress.com/2008/10/22/text-area-scrolling/
    db

  • How to find last row in itab?

    hi experts,
                  How to find the last row or item in an itab.I am using if statement for which i have to check the last row and if it is the last row some set of statements should trigger.
    thanks
    mani

    Just, find the last record :
    * Standard table
      DESCRIBE TABLE itab LINES n.
      READ TABLE itab INDEX n.
    Check on the table with special work at last record :
    * Loop
      LOOP AT itab.
        MOVE itab TO wa_itab.
        AT LAST.
    * here wa_itab is the last record (itab is *****)
        ENDAT.
      ENDLOOP.
    Regards

  • How to open on last row

    How do I open numbers on the last row I completed?  It always opens on row 890 and I need it to open on 1086.

    Here is the filed report.
    Bug ID# 9759704
    Summary:
    Numbers doesn’t open documents in the cell selected when saved
    Steps to Reproduce:
    Open a Numbers document with about 200 rows in a table.
    Set the zoom factor to 150% (default is 100%)
    Select the cell A200
    Save the document
    Close it
    Re-open it
    Expected Results:
    We expect to get the cell A200 selected in the displayed area as it is when the zoom factor is 100.
    Actual Results:
    In fact, the cell is well selected but the displayed area isn’t the wanted one.
    Here it display rows 123 thru 154.
    Clearly, the algorithm  used to calculate it fails to take care of the zoom factor.
    Regression:
    None. just wait that Apple Engineers correct their wrong algorithm or work with zoom factor 100.
    Notes:
    Would be fine to give us the ability to define the zoomfactor of our choice as we may do in Pages which is not restricted to a predefined list of factors.
    Would be glad to get feedback from users.
    Here,when zoom factor is 150 %, if the displayed area embed rows 180 thru 211 when I save, on re-open it display rows 120 to 152.
    120 is 180/1.5
    Wish to know if it's the same for you
    Yvan KOENIG (VALLAURIS, France) mardi 12 juillet 2011 14:29:17
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • How can I delete the last row of a Matrix

    Hi All,
    Does anyone know whether deleting the last row of a matrix controlled by a UDO child table gives problems? I have the strange effect that I cannot delete the very last existing row in the matrix, i.e. after updating the delete the last to-be deleted row comes back into my matrix !!
    I give you a snippet of my code (function getSelectedRow gives the selected row in the matrix):
    ==
    if (evnt.ItemUID.Equals(ViewConstants.Items.DELETEBUTTON))
      if (evnt.EventType == BoEventTypes.et_ITEM_PRESSED)
        if (evnt.BeforeAction)
          form = BusinessOne.Application.Forms.Item(formUID);
          mtx = (Matrix)form.Items.Item(ViewConstants.Items.MATRIX).Specific;
         int numRow = getSelectedRow(mtx);
         if (numRow != -1)
                                            mtx.DeleteRow(numRow);
                                            form.Mode = BoFormMode.fm_UPDATE_MODE;
                                       Item btn = (Item)form.Items.Item(ViewConstants.Items.ADDBUTTON);
                                       btn.Enabled = true;
    ==
    Cheers,
    Marcel Peek
    Alpha One
    Message was edited by: Marcel Peek
    Message was edited by: Marcel Peek

    Yes, there is a problem to delete the last row.
    It is fixed in version 2005.

  • How to auto scroll a table to last row when using Active Data Service?  11g

    Hi all,
    Has anyone got any experience with the ADF Active Data Service?
    I am using an af:table in combination with the ADF Active Data Service and I want the table to scroll to the latest row when new data arrives.
    It is basically a simple setup:
    The value attribute of my table points to a bean that extends CollectionModel and implements ActiveDataModel. This works perfectly. A soon as I receive new data in my bean, the table is automatically updated (e.g. a new row is inserted). I use JDev version: 11.1.1.3
    The problem is that I can not get the scroll bar to move down to the last row automatically when new data arrives. The auto scroll only works for the client that actually performs a submit. In other words the person that submits the new data, will see his scrollbar move down, this is because I added the following code:
    RowKeySet rowkeysset = chatTableBinding.getSelectedRowKeys();
    rowkeysset.clear();
    rowkeysset.add(getRowKey());
    AdfFacesContext.getCurrentInstance().addPartialTarget(this.chatTableBinding);
    This does not work for the clients that receive the new data via the Active data model. Apparently the active data service partially refreshes the table, but not in such a way that it sets the selected row to the last row?
    My table definition:
    <af:table value="#{pageFlowScope.chatBean.instantMessagingChatwindowBean}" var="row"
    id="t1" columnStretching="last" rows="10"
    styleClass="AFStretchWidth" autoHeightRows="10" contentDelivery="immediate"
    horizontalGridVisible="false"
    verticalGridVisible="false"
    disableColumnReordering="true" displayRow="last"
    rowSelection="single"
    binding="#{pageFlowScope.chatBean.instantMessagingChatwindowBean.chatTableBinding}"
    inlineStyle="height:80px;">
    p.s.
    The table is used to show incoming chat message.
    I am building a chat client (taskflow) in a Webcenter application. The concept is similar of that presented by Lucas Jellemain in his blogpost on building a Google Talk Client http://www.oracle.com/technetwork/articles/jellema-googletalk-094343.html

    Dan,
    This is a thanks for posting your findings. You saved me quite some time.
    <af:selectBooleanCheckbox id="showOnlyActiveSubscriptions" selected="true"
    label="Show only active services:"
    value="#{servicePortfolioBean.showOnlyActiveSubscriptions}"
    autoSubmit="true" />
    <af:table binding="#{servicePortfolioBean.serviceTable}" ...
    partialTriggers="showOnlyActiveSubscriptions">
    Of course, when I add a "ValueChangeListener" to the selectBooleanCheckbox, the PPR stops working. :( I wonder why?

  • How to get the last row

    I have 10 rows in my table and I have to retrive last row using rownum.
    For this I use
    SELECT * from <table_name>
    where rownum<=10
    minus
    SELECT * from <table_name>
    where rownum<=9
    The result is no rows selected
    In the same case if I use
    SELECT rownum from <table_name>
    Where rownum <= 10
    minus
    SELECT rownum from <table_name>
    where rownum <=9
    The result is 10
    Why this happend.
    If the result is 10, then why the row whose rowid is 10 is not retrived

    All
    Please bear in mind that ROWNUM is an attribute of the query NOT the table. The last row returned by an unORDERed SELECT statement may be the most recently inserted row but is not guaranteed to be so.
    The only way of assuring yourself of returning the most recent row is either to timestamp all your tables with a date_created column or to use a primary key with an ascending value.
    rgds, APC

  • Adobe form:How to Print last row of body to next page & printing max7 rows?

    Hi,
    In ADOBE PDF, Design view, for item level data only 7 row or less should appear in first page for following page if rows are greater than 7 if its less than  7 then last row should be on second page. In design page Below Body Row, user details are 'positioned' so they overlap as soon as item level data exceeds 7.
    Using a Static PDF, 7.2. I checked with Pagination property of Item level data, its been set to Place:Following previous and After Continue filling parent. Will putting condition using Form Calc would suffice in condition breaks? What would be condition?
    Thanks
    Mohinder

    Hi,
    Solved by changing Condition in Table pane, making one row and increasing Header and footer.
    Thanks
    Mohinder

  • How To Find Last Row With Data +2, Then Format?

    I need to find the last row +2, select the range A:L, then format.
    Could someone please supply the code?  I can handle the format part.
    Thanks!
    A. Wolf

    Works great!
    I need to do 2 other things:
    1) Add a text value to r in A: & center over selection A:L
    Dim r As Long
        r = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
           USED THIS BUT ENDING UP IN MIDDLE OF L:!
        ActiveCell = Range("A" & r)
        ActiveCell.Value = "Estimated True Up Total"
    2) 2) Format a total in r as currency/2 decimels/aligned to right.
    THANKS AGAIN!!!
    A. Wolf

  • How do I remove the last row in a csv data file

    I would like to remove the last row of data from a csv file that I have saved.  I can identify the start byte of the last row; however, I'm not sure what tool is the best one to remove it.  Should I move the EOF?  Should I open the file up to that point then save over the old one?  Is there another way I don't know about?  I am using labview 7.1.
    Thanks

    I would use the Read Text File.  You can right-click on it and tell it to read lines.  Then Delete From Array.  Leave the index and length unwired and it will delete the last item (I noticed your code is removing the second line).  Then open the file again set to replace or create and write your data.  This method allows you to propagate your errors instead of the Write/Read Spreadsheet File handling the errors for you.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Remove last row of csv_BD.png ‏14 KB

Maybe you are looking for