+ Reply to Thread
Results 1 to 3 of 3

UserForm Problem

  1. #1
    Registered User
    Join Date
    03-26-2006
    Posts
    13

    Exclamation UserForm Problem

    Hi guys,
    When I insert the data in the Userform, it's not going to fill the database.
    I am sure there are a problem with the VBA for the combobox or at least I think..
    Could you please help me???
    Thanks a lot
    Attached Files Attached Files

  2. #2
    Chip Pearson
    Guest

    Re: UserForm Problem

    Most people will not open attachments due to the risk of viruses
    or nefarious code. You should post the relevant code in the body
    of your message.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "the dude"
    <[email protected]> wrote in
    message
    news:[email protected]...
    >
    > Hi guys,
    > When I insert the data in the Userform, it's not going to fill
    > the
    > database.
    > I am sure there are a problem with the VBA for the combobox or
    > at least
    > I think..
    > Could you please help me???
    > Thanks a lot
    >
    >
    > +-------------------------------------------------------------------+
    > |Filename: matrix3.zip
    > |
    > |Download: http://www.excelforum.com/attachment.php?postid=4828
    > |
    > +-------------------------------------------------------------------+
    >
    > --
    > the dude
    > ------------------------------------------------------------------------
    > the dude's Profile:
    > http://www.excelforum.com/member.php...o&userid=32838
    > View this thread:
    > http://www.excelforum.com/showthread...hreadid=547210
    >




  3. #3
    Registered User
    Join Date
    03-26-2006
    Posts
    13

    Userform problem

    Hello, I didn't know that..

    The code is

    Private Sub cmdAdd_Click()
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Customer_Data")

    'find first empty row in database
    iRow = ws.Cells(Rows.Count, 1) _
    .End(xlUp).Offset(1, 0).Row

    'check for an ID number
    If Trim(Me.ID.Value) = "" Then
    Me.ID.SetFocus
    MsgBox "Please enter an ID number"
    Exit Sub
    End If

    'copy the data to the database
    With ws
    ws.Cells(iRow, 1).Value = Me.ID.Value
    ws.Cells(iRow, 2).Value = Me.Tier.Value
    ws.Cells(iRow, 3).Value = Me.Age.Value
    ws.Cells(iRow, 4).Value = Me.Spend.Value
    ws.Cells(iRow, 5).Value = Me.Acc_struct.Value
    ws.Cells(iRow, 6).Value = Me.cart.Value
    ws.Cells(iRow, 7).Value = Me.Rank.Value
    ws.Cells(iRow, 8).Value = Me.Lang.Value
    ws.Cells(iRow, 9).Value = Me.Cont.Value
    ws.Cells(iRow, 10).Value = Me.Vertical.Value
    End With

    'clear the data

    Me.ID.Value = ""
    Me.Tier.Value = ""
    Me.Age.Value = ""
    Me.Spend.Value = ""
    Me.cart.Value = ""
    Me.Rank.Value = ""
    Me.Lang.Value = ""
    Me.Cont.Value = ""
    Me.Vertical.Value = ""

    End Sub



    Private Sub CmdClose_Click()
    Unload Me
    End Sub


    Private Sub UserForm_Initialize()

    Dim Tier As Range
    Dim Age As Range
    Dim Spend As Range
    Dim Acc_struct As Range
    Dim cart As Range
    Dim Rank As Range
    Dim Lang As Range
    Dim Cont As Range
    Dim Vertical As Range

    Me.ID.SetFocus

    End Sub

    But it seems there is a problem and I don't know how to assign the data to the combobox (i think this is the problem)..
    What do you think?
    Thanks

+ 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