+ Reply to Thread
Results 1 to 7 of 7

Listbox selection creates form

  1. #1
    Jennifer
    Guest

    Listbox selection creates form

    Hello Hello,
    Here is a new one. I have a userform with one listbox(lstTreatment) and a
    button(cmdSelect). I have it set up so the user can select multiple
    selections in the listbox.

    Next, I have created another userform that has a text box for the RFID when
    scanned, then there are 10 lables (label1, label2, etc.)

    Problem: I would like the selections choosen from the 1st userform to fill
    the labels in the second userform. Soooo . . . if the user selects from the
    listbox:
    1. Vaccinate
    2. Deworm
    Those two selections will be the names of label1 and label2.

    I hope this makes sense! Thanks guys!

    Anyone have any recommendations on classes or great books on learning FoxPro?
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer

  2. #2
    NickHK
    Guest

    Re: Listbox selection creates form

    Jennifer,
    On the first form, with your listbox and cmdSelect:

    Private Sub UserForm_Initialize()
    With ListBox1
    .AddItem "Vaccinate"
    .AddItem "Deworm"
    .AddItem "Neuter"
    .AddItem "Inseminate"
    .AddItem "Put Down"
    End With

    End Sub

    Private Sub cmdSelect_Click()
    Dim i As Long
    Dim SelCount As Long

    With ListBox1
    For i = 0 To .ListCount - 1
    If .Selected(i) = True Then
    SelCount = SelCount + 1
    UserForm2.Controls("Label" & SelCount).Caption = .List(i)
    End If
    Next
    End With

    UserForm2.Show

    End Sub

    UserForm2 has 10 labels called "Label1" ~ "Label10", with some default
    caption of "Not set" or blank.
    You should add some error trapping/checking that the number of options in
    the list box does not exceed the number of available labels.

    NickHK

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > Hello Hello,
    > Here is a new one. I have a userform with one listbox(lstTreatment) and a
    > button(cmdSelect). I have it set up so the user can select multiple
    > selections in the listbox.
    >
    > Next, I have created another userform that has a text box for the RFID

    when
    > scanned, then there are 10 lables (label1, label2, etc.)
    >
    > Problem: I would like the selections choosen from the 1st userform to fill
    > the labels in the second userform. Soooo . . . if the user selects from

    the
    > listbox:
    > 1. Vaccinate
    > 2. Deworm
    > Those two selections will be the names of label1 and label2.
    >
    > I hope this makes sense! Thanks guys!
    >
    > Anyone have any recommendations on classes or great books on learning

    FoxPro?
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer




  3. #3
    Jennifer
    Guest

    Re: Listbox selection creates form

    Nick,
    I am getting an and error "could not find specified object"
    it then highlights this part of the code:
    UserForm2.Controls("Label" & SelCount).Caption = .List(i)

    Thank you so much for your help.
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "NickHK" wrote:

    > Jennifer,
    > On the first form, with your listbox and cmdSelect:
    >
    > Private Sub UserForm_Initialize()
    > With ListBox1
    > .AddItem "Vaccinate"
    > .AddItem "Deworm"
    > .AddItem "Neuter"
    > .AddItem "Inseminate"
    > .AddItem "Put Down"
    > End With
    >
    > End Sub
    >
    > Private Sub cmdSelect_Click()
    > Dim i As Long
    > Dim SelCount As Long
    >
    > With ListBox1
    > For i = 0 To .ListCount - 1
    > If .Selected(i) = True Then
    > SelCount = SelCount + 1
    > UserForm2.Controls("Label" & SelCount).Caption = .List(i)
    > End If
    > Next
    > End With
    >
    > UserForm2.Show
    >
    > End Sub
    >
    > UserForm2 has 10 labels called "Label1" ~ "Label10", with some default
    > caption of "Not set" or blank.
    > You should add some error trapping/checking that the number of options in
    > the list box does not exceed the number of available labels.
    >
    > NickHK
    >
    > "Jennifer" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello Hello,
    > > Here is a new one. I have a userform with one listbox(lstTreatment) and a
    > > button(cmdSelect). I have it set up so the user can select multiple
    > > selections in the listbox.
    > >
    > > Next, I have created another userform that has a text box for the RFID

    > when
    > > scanned, then there are 10 lables (label1, label2, etc.)
    > >
    > > Problem: I would like the selections choosen from the 1st userform to fill
    > > the labels in the second userform. Soooo . . . if the user selects from

    > the
    > > listbox:
    > > 1. Vaccinate
    > > 2. Deworm
    > > Those two selections will be the names of label1 and label2.
    > >
    > > I hope this makes sense! Thanks guys!
    > >
    > > Anyone have any recommendations on classes or great books on learning

    > FoxPro?
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer

    >
    >
    >


  4. #4
    Jennifer
    Guest

    Re: Listbox selection creates form

    Oops I figured it out. The problem was that I had another label for the RFID
    text box and one for the date. So now my question is how can I have these
    other two lables and it fill the label1>label10.

    It just never ends! Ha!
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "NickHK" wrote:

    > Jennifer,
    > On the first form, with your listbox and cmdSelect:
    >
    > Private Sub UserForm_Initialize()
    > With ListBox1
    > .AddItem "Vaccinate"
    > .AddItem "Deworm"
    > .AddItem "Neuter"
    > .AddItem "Inseminate"
    > .AddItem "Put Down"
    > End With
    >
    > End Sub
    >
    > Private Sub cmdSelect_Click()
    > Dim i As Long
    > Dim SelCount As Long
    >
    > With ListBox1
    > For i = 0 To .ListCount - 1
    > If .Selected(i) = True Then
    > SelCount = SelCount + 1
    > UserForm2.Controls("Label" & SelCount).Caption = .List(i)
    > End If
    > Next
    > End With
    >
    > UserForm2.Show
    >
    > End Sub
    >
    > UserForm2 has 10 labels called "Label1" ~ "Label10", with some default
    > caption of "Not set" or blank.
    > You should add some error trapping/checking that the number of options in
    > the list box does not exceed the number of available labels.
    >
    > NickHK
    >
    > "Jennifer" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello Hello,
    > > Here is a new one. I have a userform with one listbox(lstTreatment) and a
    > > button(cmdSelect). I have it set up so the user can select multiple
    > > selections in the listbox.
    > >
    > > Next, I have created another userform that has a text box for the RFID

    > when
    > > scanned, then there are 10 lables (label1, label2, etc.)
    > >
    > > Problem: I would like the selections choosen from the 1st userform to fill
    > > the labels in the second userform. Soooo . . . if the user selects from

    > the
    > > listbox:
    > > 1. Vaccinate
    > > 2. Deworm
    > > Those two selections will be the names of label1 and label2.
    > >
    > > I hope this makes sense! Thanks guys!
    > >
    > > Anyone have any recommendations on classes or great books on learning

    > FoxPro?
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer

    >
    >
    >


  5. #5
    NickHK
    Guest

    Re: Listbox selection creates form

    Jennifer,
    Not sure what you mean.
    This fills your labels with the required captions and I assumed the user
    would enter the RFID and date.
    If not, then where is this info coming from ?

    NickHK

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > Oops I figured it out. The problem was that I had another label for the

    RFID
    > text box and one for the date. So now my question is how can I have these
    > other two lables and it fill the label1>label10.
    >
    > It just never ends! Ha!
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer
    >
    >
    > "NickHK" wrote:
    >
    > > Jennifer,
    > > On the first form, with your listbox and cmdSelect:
    > >
    > > Private Sub UserForm_Initialize()
    > > With ListBox1
    > > .AddItem "Vaccinate"
    > > .AddItem "Deworm"
    > > .AddItem "Neuter"
    > > .AddItem "Inseminate"
    > > .AddItem "Put Down"
    > > End With
    > >
    > > End Sub
    > >
    > > Private Sub cmdSelect_Click()
    > > Dim i As Long
    > > Dim SelCount As Long
    > >
    > > With ListBox1
    > > For i = 0 To .ListCount - 1
    > > If .Selected(i) = True Then
    > > SelCount = SelCount + 1
    > > UserForm2.Controls("Label" & SelCount).Caption = .List(i)
    > > End If
    > > Next
    > > End With
    > >
    > > UserForm2.Show
    > >
    > > End Sub
    > >
    > > UserForm2 has 10 labels called "Label1" ~ "Label10", with some default
    > > caption of "Not set" or blank.
    > > You should add some error trapping/checking that the number of options

    in
    > > the list box does not exceed the number of available labels.
    > >
    > > NickHK
    > >
    > > "Jennifer" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Hello Hello,
    > > > Here is a new one. I have a userform with one listbox(lstTreatment)

    and a
    > > > button(cmdSelect). I have it set up so the user can select multiple
    > > > selections in the listbox.
    > > >
    > > > Next, I have created another userform that has a text box for the RFID

    > > when
    > > > scanned, then there are 10 lables (label1, label2, etc.)
    > > >
    > > > Problem: I would like the selections choosen from the 1st userform to

    fill
    > > > the labels in the second userform. Soooo . . . if the user selects

    from
    > > the
    > > > listbox:
    > > > 1. Vaccinate
    > > > 2. Deworm
    > > > Those two selections will be the names of label1 and label2.
    > > >
    > > > I hope this makes sense! Thanks guys!
    > > >
    > > > Anyone have any recommendations on classes or great books on learning

    > > FoxPro?
    > > > --
    > > > Though daily learning, I LOVE EXCEL!
    > > > Jennifer

    > >
    > >
    > >




  6. #6
    Jennifer
    Guest

    Re: Listbox selection creates form

    No your right Nick about the labels . . . but , at the top of the form across
    the top I have a txtbox for the date and the scanned RFID but I have used a
    label that says "Date" and "RFID" so the user know were to enter the date or
    scan the RFID.

    Hmmm hope that made sense. Jennifer
    --
    Though daily learning, I LOVE EXCEL!
    Jennifer


    "NickHK" wrote:

    > Jennifer,
    > Not sure what you mean.
    > This fills your labels with the required captions and I assumed the user
    > would enter the RFID and date.
    > If not, then where is this info coming from ?
    >
    > NickHK
    >
    > "Jennifer" <[email protected]> wrote in message
    > news:[email protected]...
    > > Oops I figured it out. The problem was that I had another label for the

    > RFID
    > > text box and one for the date. So now my question is how can I have these
    > > other two lables and it fill the label1>label10.
    > >
    > > It just never ends! Ha!
    > > --
    > > Though daily learning, I LOVE EXCEL!
    > > Jennifer
    > >
    > >
    > > "NickHK" wrote:
    > >
    > > > Jennifer,
    > > > On the first form, with your listbox and cmdSelect:
    > > >
    > > > Private Sub UserForm_Initialize()
    > > > With ListBox1
    > > > .AddItem "Vaccinate"
    > > > .AddItem "Deworm"
    > > > .AddItem "Neuter"
    > > > .AddItem "Inseminate"
    > > > .AddItem "Put Down"
    > > > End With
    > > >
    > > > End Sub
    > > >
    > > > Private Sub cmdSelect_Click()
    > > > Dim i As Long
    > > > Dim SelCount As Long
    > > >
    > > > With ListBox1
    > > > For i = 0 To .ListCount - 1
    > > > If .Selected(i) = True Then
    > > > SelCount = SelCount + 1
    > > > UserForm2.Controls("Label" & SelCount).Caption = .List(i)
    > > > End If
    > > > Next
    > > > End With
    > > >
    > > > UserForm2.Show
    > > >
    > > > End Sub
    > > >
    > > > UserForm2 has 10 labels called "Label1" ~ "Label10", with some default
    > > > caption of "Not set" or blank.
    > > > You should add some error trapping/checking that the number of options

    > in
    > > > the list box does not exceed the number of available labels.
    > > >
    > > > NickHK
    > > >
    > > > "Jennifer" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > Hello Hello,
    > > > > Here is a new one. I have a userform with one listbox(lstTreatment)

    > and a
    > > > > button(cmdSelect). I have it set up so the user can select multiple
    > > > > selections in the listbox.
    > > > >
    > > > > Next, I have created another userform that has a text box for the RFID
    > > > when
    > > > > scanned, then there are 10 lables (label1, label2, etc.)
    > > > >
    > > > > Problem: I would like the selections choosen from the 1st userform to

    > fill
    > > > > the labels in the second userform. Soooo . . . if the user selects

    > from
    > > > the
    > > > > listbox:
    > > > > 1. Vaccinate
    > > > > 2. Deworm
    > > > > Those two selections will be the names of label1 and label2.
    > > > >
    > > > > I hope this makes sense! Thanks guys!
    > > > >
    > > > > Anyone have any recommendations on classes or great books on learning
    > > > FoxPro?
    > > > > --
    > > > > Though daily learning, I LOVE EXCEL!
    > > > > Jennifer
    > > >
    > > >
    > > >

    >
    >
    >


  7. #7
    NickHK
    Guest

    Re: Listbox selection creates form

    Jennifer,
    So it all OK now ?

    NickHK

    "Jennifer" <[email protected]> wrote in message
    news:[email protected]...
    > No your right Nick about the labels . . . but , at the top of the form

    across
    > the top I have a txtbox for the date and the scanned RFID but I have used

    a
    > label that says "Date" and "RFID" so the user know were to enter the date

    or
    > scan the RFID.
    >
    > Hmmm hope that made sense. Jennifer
    > --
    > Though daily learning, I LOVE EXCEL!
    > Jennifer
    >
    >
    > "NickHK" wrote:
    >
    > > Jennifer,
    > > Not sure what you mean.
    > > This fills your labels with the required captions and I assumed the user
    > > would enter the RFID and date.
    > > If not, then where is this info coming from ?
    > >
    > > NickHK
    > >
    > > "Jennifer" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > Oops I figured it out. The problem was that I had another label for

    the
    > > RFID
    > > > text box and one for the date. So now my question is how can I have

    these
    > > > other two lables and it fill the label1>label10.
    > > >
    > > > It just never ends! Ha!
    > > > --
    > > > Though daily learning, I LOVE EXCEL!
    > > > Jennifer
    > > >
    > > >
    > > > "NickHK" wrote:
    > > >
    > > > > Jennifer,
    > > > > On the first form, with your listbox and cmdSelect:
    > > > >
    > > > > Private Sub UserForm_Initialize()
    > > > > With ListBox1
    > > > > .AddItem "Vaccinate"
    > > > > .AddItem "Deworm"
    > > > > .AddItem "Neuter"
    > > > > .AddItem "Inseminate"
    > > > > .AddItem "Put Down"
    > > > > End With
    > > > >
    > > > > End Sub
    > > > >
    > > > > Private Sub cmdSelect_Click()
    > > > > Dim i As Long
    > > > > Dim SelCount As Long
    > > > >
    > > > > With ListBox1
    > > > > For i = 0 To .ListCount - 1
    > > > > If .Selected(i) = True Then
    > > > > SelCount = SelCount + 1
    > > > > UserForm2.Controls("Label" & SelCount).Caption =

    ..List(i)
    > > > > End If
    > > > > Next
    > > > > End With
    > > > >
    > > > > UserForm2.Show
    > > > >
    > > > > End Sub
    > > > >
    > > > > UserForm2 has 10 labels called "Label1" ~ "Label10", with some

    default
    > > > > caption of "Not set" or blank.
    > > > > You should add some error trapping/checking that the number of

    options
    > > in
    > > > > the list box does not exceed the number of available labels.
    > > > >
    > > > > NickHK
    > > > >
    > > > > "Jennifer" <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > > > Hello Hello,
    > > > > > Here is a new one. I have a userform with one

    listbox(lstTreatment)
    > > and a
    > > > > > button(cmdSelect). I have it set up so the user can select

    multiple
    > > > > > selections in the listbox.
    > > > > >
    > > > > > Next, I have created another userform that has a text box for the

    RFID
    > > > > when
    > > > > > scanned, then there are 10 lables (label1, label2, etc.)
    > > > > >
    > > > > > Problem: I would like the selections choosen from the 1st userform

    to
    > > fill
    > > > > > the labels in the second userform. Soooo . . . if the user selects

    > > from
    > > > > the
    > > > > > listbox:
    > > > > > 1. Vaccinate
    > > > > > 2. Deworm
    > > > > > Those two selections will be the names of label1 and label2.
    > > > > >
    > > > > > I hope this makes sense! Thanks guys!
    > > > > >
    > > > > > Anyone have any recommendations on classes or great books on

    learning
    > > > > FoxPro?
    > > > > > --
    > > > > > Though daily learning, I LOVE EXCEL!
    > > > > > Jennifer
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




+ 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