Results 1 to 3 of 3

Form input to update list

Threaded View

  1. #2
    Forum Contributor
    Join Date
    06-28-2004
    MS-Off Ver
    Home/Office 2016
    Posts
    259

    Re: Form input to update list

    After an 'exhaustive' internet search....I finally came up with something myself - with minor tweaks....thanks to all those that tried!
    I've attached the sample with the working code. This auto-numbers the draft picks and puts the 'S1' in the contract field.

    Private Sub cmdOK_Click()

    Dim i As Integer

    'position cursor in the correct cell C10.
    Range("B9").Select
    i = 0 'set as the first ID

    'validate POSITION field has been entered...
    If Me.cboPosition.Text = Empty Then 'Position
    MsgBox "Please enter player position.", vbExclamation
    Me.cboPosition.SetFocus 'position cursor to try again
    Exit Sub 'terminate here - why continue?
    End If
    '
    'validate PLAYER NAME field has been entered...
    If Me.cboPlayerName.Text = Empty Then 'Player Name
    MsgBox "Please enter the Player's Name.", vbExclamation
    Me.cboPlayerName.SetFocus 'position cursor to try again
    Exit Sub 'terminate here - why continue?
    End If
    '
    'validate NFL TEAM field has been entered...
    If Me.cboNFLTeam.Text = Empty Then 'NFL Team
    MsgBox "Please choose an NFL team.", vbExclamation
    Me.cboNFLTeam.SetFocus 'position cursor to try again
    Exit Sub 'terminate here - why continue?
    End If
    '
    'validate SALARY field has been entered...
    If Me.txtSalary.Text = Empty Then 'Salary
    MsgBox "Please enter the player's salary.", vbExclamation
    Me.txtSalary.SetFocus 'position cursor to try again
    Exit Sub 'terminate here - why continue?
    End If
    '
    'validate PFL TEAM field has been entered...
    If Me.cboPFLTeam.Text = Empty Then 'PFL Team
    MsgBox "Please choose an PFL team.", vbExclamation
    Me.cboPFLTeam.SetFocus 'position cursor to try again
    Exit Sub 'terminate here - why continue?
    End If
    '
    'if all the above are false (OK) then carry on.
    'check to see the next available blank row start at cell B10...
    Do Until ActiveCell.Value = Empty
    ActiveCell.Offset(1, 0).Select 'move down 1 row
    i = i + 1 'keep a count of the ID for later use
    Loop

    'Populate the new data values into the 'Data' worksheet.
    ActiveCell.Value = i 'Next ID number
    ActiveCell.Offset(0, 1).Value = Me.cboPosition.Text 'set col C
    ActiveCell.Offset(0, 2).Value = Me.cboPlayerName.Text 'set col D
    ActiveCell.Offset(0, 5).Value = Me.cboNFLTeam.Text 'set col G
    ActiveCell.Offset(0, 6).Value = "S1" 'set col H
    ActiveCell.Offset(0, 7).Value = Me.txtSalary.Text 'set col I
    ActiveCell.Offset(0, 8).Value = Me.cboPFLTeam.Text 'set col J
    ActiveCell.Offset(0, 9).Value = Me.cboIR.Text 'set col K


    ' 'Clear down the values ready for the next record entry...
    Me.cboPosition.Text = Empty
    Me.cboPlayerName.Text = Empty
    Me.cboNFLTeam.Text = Empty
    Me.txtSalary.Text = Empty
    Me.cboPFLTeam.Text = Empty
    Me.cboIR.Text = Empty
    Me.cboPosition.SetFocus 'positions the cursor for next record entry


    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Form Button to update list
    By sneaders in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2013, 09:38 AM
  2. Update List without closing User Form
    By Jogier505 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2010, 04:36 PM
  3. Input form with criterion-based selection list
    By TPFKAS in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-27-2009, 05:05 PM
  4. add list user form, list box and get input
    By rajaneeshjandhyam in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-18-2009, 10:57 PM
  5. Input data form with drop down list
    By PA in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2006, 07:20 PM

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