+ Reply to Thread
Results 1 to 2 of 2

initialize form field from previous entry

  1. #1
    vince c via OfficeKB.com
    Guest

    initialize form field from previous entry


    I'm using the menu's Data Form function called by a macro to enter new
    records to a spreadsheet database used to track employee time to be billed on
    client matters. For simplicity, assume the fields corresponding to the
    columns in the database are: employee, file number, time, code and code
    description. It is common that groups of related records are entered in
    sequence where, for example, each new record in a group is has the same file
    number and employee. Employee and code fields validate from respective lists.
    Code decription field populates from a VLOOKUP function based on code field
    entered. I'm calling the Data Form from the menu via a macro. Each new
    entry, however, begins with a clear cell for each field. I'd like to have
    the fields, at least employee and file number fields, for each new record to
    be added initialize with the values entered for the immediately previous
    record so that the information does not need to be re-entered for each new
    record. Is there any way to do this using the Data Form? Will I need to
    create a different data entry form in VB? Very much a newbie attempting this
    but generally a quick study.

    Thanks!


    --
    Message posted via http://www.officekb.com

  2. #2
    Registered User
    Join Date
    12-20-2004
    Posts
    6

    Input Field

    As far as I can tell, You will need to create a text_box Enter private sub

    I just put 1 small column of data in but the theory should hold true for your example. For each field you want to be pre populated you could reference the colomn in the last data you entered. I referenced A1 as the only cell to look at, but in your case you're constantly entering in data into multiple columns so you'll have to code in something like this for each column of data, and subsequently each text box:

    Private Sub TextBox1_Enter()
    'locate the column of data you want to reference the last cell in
    Range("A1").select
    'Find the last cell (assuming no blank cells)
    Selection.End(xlDown).Select
    TextBox1.Value = Selection.Value
    End Sub

    Keep in mind you'll also need the requisite TextBox_1Change() to enter your data into the next cell.

    Hope this helps.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1