ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listbox selection creates form (https://www.excelbanter.com/excel-programming/355396-listbox-selection-creates-form.html)

Jennifer

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

NickHK

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" wrote in message
...
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




Jennifer

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" wrote in message
...
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





Jennifer

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 label1label10.

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" wrote in message
...
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





NickHK

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" wrote in message
...
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 label1label10.

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" wrote in message
...
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







Jennifer

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" wrote in message
...
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 label1label10.

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" wrote in message
...
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







NickHK

Listbox selection creates form
 
Jennifer,
So it all OK now ?

NickHK

"Jennifer" wrote in message
...
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" wrote in message
...
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 label1label10.

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" wrote in message
...
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










All times are GMT +1. The time now is 08:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com