how to cause checked yes/no items to appear in a list in another part of the form...

R

Repent

I have a form with many yes/no checkboxes on it.
if the user has had an issue with a particular item, he checkes the
box under that item. I'd then like to have a list box on another part
of the form to list those items the user placed a check next to.

The idea is that the checkboxes the user has to decide on live deep in
the form so if there was a list box of all the items that are checked
on the front of the form, it would make it easier for the user to see
all his choices.

the list box at this point only need to be a listing of those checked
items, one item per line.

how can I do this?

thanks all;
 
F

fredg

I have a form with many yes/no checkboxes on it.
if the user has had an issue with a particular item, he checkes the
box under that item. I'd then like to have a list box on another part
of the form to list those items the user placed a check next to.

The idea is that the checkboxes the user has to decide on live deep in
the form so if there was a list box of all the items that are checked
on the front of the form, it would make it easier for the user to see
all his choices.

the list box at this point only need to be a listing of those checked
items, one item per line.

how can I do this?

thanks all;

So you just wish to display the items checked as the operator is
entering them ... without saving this data?

Add an unbound text control to the form.
Size it tall enough to display expected data.
Add a vertical scroll bar if you think it might be needed.

Then code the AfterUpdate event of each Check box field:

If Me.CheckName = -1 Then
Me.TextControlName = Me.TextControlName & "ItemName" & vbNewLine
Else
Me.TextControlName = Replace(Me.TextControlName,"ItemName" &
vbNewLine,"")
End If

The appropriate field name will be added to the text control if the
check box is checked.
If the check is later removed from the check box, the Item name will
be removed from the text control.

To clear the check box when navigating to a different record, code the
Form's Current event:
Me.TextControlName = Null
 
R

Repent

what do i put for "checkname" is it the name of the checkbox? in this
case its Payoff-Blue Factory Splices. Do i need to do something about
the spaces in the name?

also what about textcontrolname and itemname what values go there?

chris
 
F

fredg

On Thu, 05 Nov 2009 16:30:56 -0800, Repent wrote:

Reply interspersed below.

Those of us who reply to questions often have no idea of the actual
field and control names used by the questioner (unless he/she gives us
that information).
So, we use generic terms, such as ControlName, TableName, YourTable,
FieldName, FormName, etc.

You have to replace those generic names with the actual names of the
objects.

what do i put for "checkname" is it the name of the checkbox? in this
case its Payoff-Blue Factory Splices. Do i need to do something about
the spaces in the name?

Yes it's the name of the check box control (which may, or may not, be
the same as the field name to which the control is bound).
If the name includes spaces, always enclose it within brackets, i.e.
Me.[Payoff-Blue Factory Splices]

Note: It's never a good database design practice to include spaces
within field or control names. Payoff-BlueFactorySplices contains no
spaces and is just as easy to read as Payoff-Blue Factory Splices.
also what about textcontrolname and itemname what values go there?

In place of textcontrolname write the actual name of the text control
in which you wish to display the data. If the name has spaces within
it, i.e. "All my splices", make sure you enclose it within brackets,
[All my splices].


Replace ItemName with whatever it is you wish to enter into the text
control. Enclose it within quotes, i.e. "My Text"

So if we name the text control "All My Splices", the resulting code
would look like:

If Me.[Payoff-Blue Factory Splices] = -1 Then
Me.[All My Splices] = Me.[All My Splices] & "My text" & vbNewLine
Else
Me.[All My Splices] = Replace(Me.[All My Splices],"My text" &
vbNewLine,"")
End If

Each check box name will be different and the ItemText for each will
differ. The text control [All My Splices] will remain the same.
 
R

Repent

Fred;

When I place the code in the afterupdate event of the checkbox I get
the following error:

Compile error:
Method or data member not found.

I changed the checkbox control to reflect Camel case so no spaces in
the name.

Here is what I'm calling the controls/boxes, etc.

CheckName=Payoff-BlueFactorySplices
TextControlName=UserDisplayText
ItemName=Payoff-BlueFactorySplices


Here is the code as I've changed it:

Private Sub Payoff_BlueFactorySplices_AfterUpdate()
If Me.Payoff - BlueFactorySplices = -1 Then
Me.UserDisplayText = Me.UserDisplayText & "Payoff-BlueFactorySplices"
& vbNewLine
Else
Me.UserDisplayText = Replace(Me.UserDisplayText,
"Payoff-BlueFactorySplices" & vbNewLine, "")
End If
End Sub

When I was typing out this reply I noticed that there was a underscore
at the "Private Sub Payoff_BlueFactorySplices_AfterUpdate()" location
so I changed the "If Me.Payoff-BlueFactorySplices =-1 Then" to "If
Me.Payoff_BlueFactorySplices = -1 Then" and then I changed my
CheckName to "Payoff_BlueFactorySplices" to allow for the underscore
and it now works

My question is, why did using the underscore work and not the dash
between the words?


thank you again;

chris






On Thu, 05 Nov 2009 16:30:56 -0800, Repent wrote:

Reply interspersed below.

Those of us who reply to questions often have no idea of the actual
field and control names used by the questioner (unless he/she gives us
that information).
So, we use generic terms, such as ControlName, TableName, YourTable,
FieldName, FormName, etc.

You have to replace those generic names with the actual names of the
objects.

what do i put for "checkname" is it the name of the checkbox? in this
case its Payoff-Blue Factory Splices. Do i need to do something about
the spaces in the name?

Yes it's the name of the check box control (which may, or may not, be
the same as the field name to which the control is bound).
If the name includes spaces, always enclose it within brackets, i.e.
Me.[Payoff-Blue Factory Splices]

Note: It's never a good database design practice to include spaces
within field or control names. Payoff-BlueFactorySplices contains no
spaces and is just as easy to read as Payoff-Blue Factory Splices.
also what about textcontrolname and itemname what values go there?

In place of textcontrolname write the actual name of the text control
in which you wish to display the data. If the name has spaces within
it, i.e. "All my splices", make sure you enclose it within brackets,
[All my splices].


Replace ItemName with whatever it is you wish to enter into the text
control. Enclose it within quotes, i.e. "My Text"

So if we name the text control "All My Splices", the resulting code
would look like:

If Me.[Payoff-Blue Factory Splices] = -1 Then
Me.[All My Splices] = Me.[All My Splices] & "My text" & vbNewLine
Else
Me.[All My Splices] = Replace(Me.[All My Splices],"My text" &
vbNewLine,"")
End If

Each check box name will be different and the ItemText for each will
differ. The text control [All My Splices] will remain the same.
 
R

Repent

Fred;

In looking further into this, I would like to save the data that is
displayed in the text box with each record. Before we were talking
about only displaying the data. Now that it is working to display the
data, how do I make it keep the data displayed in the text box? I
wouldn't think I'd need to query that data later because I can query
the state of the checkboxes. I'd just like the data to remain in each
record.

thanks;

chris




Fred;

When I place the code in the afterupdate event of the checkbox I get
the following error:

Compile error:
Method or data member not found.

I changed the checkbox control to reflect Camel case so no spaces in
the name.

Here is what I'm calling the controls/boxes, etc.

CheckName=Payoff-BlueFactorySplices
TextControlName=UserDisplayText
ItemName=Payoff-BlueFactorySplices


Here is the code as I've changed it:

Private Sub Payoff_BlueFactorySplices_AfterUpdate()
If Me.Payoff - BlueFactorySplices = -1 Then
Me.UserDisplayText = Me.UserDisplayText & "Payoff-BlueFactorySplices"
& vbNewLine
Else
Me.UserDisplayText = Replace(Me.UserDisplayText,
"Payoff-BlueFactorySplices" & vbNewLine, "")
End If
End Sub

When I was typing out this reply I noticed that there was a underscore
at the "Private Sub Payoff_BlueFactorySplices_AfterUpdate()" location
so I changed the "If Me.Payoff-BlueFactorySplices =-1 Then" to "If
Me.Payoff_BlueFactorySplices = -1 Then" and then I changed my
CheckName to "Payoff_BlueFactorySplices" to allow for the underscore
and it now works

My question is, why did using the underscore work and not the dash
between the words?


thank you again;

chris






On Thu, 05 Nov 2009 16:30:56 -0800, Repent wrote:

Reply interspersed below.

Those of us who reply to questions often have no idea of the actual
field and control names used by the questioner (unless he/she gives us
that information).
So, we use generic terms, such as ControlName, TableName, YourTable,
FieldName, FormName, etc.

You have to replace those generic names with the actual names of the
objects.

what do i put for "checkname" is it the name of the checkbox? in this
case its Payoff-Blue Factory Splices. Do i need to do something about
the spaces in the name?

Yes it's the name of the check box control (which may, or may not, be
the same as the field name to which the control is bound).
If the name includes spaces, always enclose it within brackets, i.e.
Me.[Payoff-Blue Factory Splices]

Note: It's never a good database design practice to include spaces
within field or control names. Payoff-BlueFactorySplices contains no
spaces and is just as easy to read as Payoff-Blue Factory Splices.
also what about textcontrolname and itemname what values go there?

In place of textcontrolname write the actual name of the text control
in which you wish to display the data. If the name has spaces within
it, i.e. "All my splices", make sure you enclose it within brackets,
[All my splices].


Replace ItemName with whatever it is you wish to enter into the text
control. Enclose it within quotes, i.e. "My Text"

So if we name the text control "All My Splices", the resulting code
would look like:

If Me.[Payoff-Blue Factory Splices] = -1 Then
Me.[All My Splices] = Me.[All My Splices] & "My text" & vbNewLine
Else
Me.[All My Splices] = Replace(Me.[All My Splices],"My text" &
vbNewLine,"")
End If

Each check box name will be different and the ItemText for each will
differ. The text control [All My Splices] will remain the same.
chris

On Thu, 05 Nov 2009 11:12:52 -0800, Repent wrote:

I have a form with many yes/no checkboxes on it.
if the user has had an issue with a particular item, he checkes the
box under that item. I'd then like to have a list box on another part
of the form to list those items the user placed a check next to.

The idea is that the checkboxes the user has to decide on live deep in
the form so if there was a list box of all the items that are checked
on the front of the form, it would make it easier for the user to see
all his choices.

the list box at this point only need to be a listing of those checked
items, one item per line.

how can I do this?

thanks all;

So you just wish to display the items checked as the operator is
entering them ... without saving this data?

Add an unbound text control to the form.
Size it tall enough to display expected data.
Add a vertical scroll bar if you think it might be needed.

Then code the AfterUpdate event of each Check box field:

If Me.CheckName = -1 Then
Me.TextControlName = Me.TextControlName & "ItemName" & vbNewLine
Else
Me.TextControlName = Replace(Me.TextControlName,"ItemName" &
vbNewLine,"")
End If

The appropriate field name will be added to the text control if the
check box is checked.
If the check is later removed from the check box, the Item name will
be removed from the text control.

To clear the check box when navigating to a different record, code the
Form's Current event:
Me.TextControlName = Null
 
D

Douglas J. Steele

Repent said:
When I was typing out this reply I noticed that there was a underscore
at the "Private Sub Payoff_BlueFactorySplices_AfterUpdate()" location
so I changed the "If Me.Payoff-BlueFactorySplices =-1 Then" to "If
Me.Payoff_BlueFactorySplices = -1 Then" and then I changed my
CheckName to "Payoff_BlueFactorySplices" to allow for the underscore
and it now works

My question is, why did using the underscore work and not the dash
between the words?

Dashes are invalid characters for names: there's no way to distinguish
between them and minus signs.
 
R

Repent

thanks Doug that makes good sense. Think I better fix that right now
in the places I've used a dash......

chris
 
R

Repent

I think I may have figured this out (mostly) already. Only question,
how do I get the table to allow more than one checked item to populate
the table field?

What I did was added a field to my table called "UserSelectedTabItems"
and gave it the type of "memo". I then selected this new table field
to be the Control source of the previous unbound textbox.

I removed the code from the "on current" event for the form.

I placed the code of "Me.UserSelectedTabItems = Null" in the "on undo"
event procedure because I have an "undo" feature on the form that will
erase any record changes a user makes to an already established
record.

Can you help with this?

chris









Fred;

In looking further into this, I would like to save the data that is
displayed in the text box with each record. Before we were talking
about only displaying the data. Now that it is working to display the
data, how do I make it keep the data displayed in the text box? I
wouldn't think I'd need to query that data later because I can query
the state of the checkboxes. I'd just like the data to remain in each
record.

thanks;

chris




Fred;

When I place the code in the afterupdate event of the checkbox I get
the following error:

Compile error:
Method or data member not found.

I changed the checkbox control to reflect Camel case so no spaces in
the name.

Here is what I'm calling the controls/boxes, etc.

CheckName=Payoff-BlueFactorySplices
TextControlName=UserDisplayText
ItemName=Payoff-BlueFactorySplices


Here is the code as I've changed it:

Private Sub Payoff_BlueFactorySplices_AfterUpdate()
If Me.Payoff - BlueFactorySplices = -1 Then
Me.UserDisplayText = Me.UserDisplayText & "Payoff-BlueFactorySplices"
& vbNewLine
Else
Me.UserDisplayText = Replace(Me.UserDisplayText,
"Payoff-BlueFactorySplices" & vbNewLine, "")
End If
End Sub

When I was typing out this reply I noticed that there was a underscore
at the "Private Sub Payoff_BlueFactorySplices_AfterUpdate()" location
so I changed the "If Me.Payoff-BlueFactorySplices =-1 Then" to "If
Me.Payoff_BlueFactorySplices = -1 Then" and then I changed my
CheckName to "Payoff_BlueFactorySplices" to allow for the underscore
and it now works

My question is, why did using the underscore work and not the dash
between the words?


thank you again;

chris






On Thu, 05 Nov 2009 16:30:56 -0800, Repent wrote:

Reply interspersed below.

Those of us who reply to questions often have no idea of the actual
field and control names used by the questioner (unless he/she gives us
that information).
So, we use generic terms, such as ControlName, TableName, YourTable,
FieldName, FormName, etc.

You have to replace those generic names with the actual names of the
objects.


what do i put for "checkname" is it the name of the checkbox? in this
case its Payoff-Blue Factory Splices. Do i need to do something about
the spaces in the name?

Yes it's the name of the check box control (which may, or may not, be
the same as the field name to which the control is bound).
If the name includes spaces, always enclose it within brackets, i.e.
Me.[Payoff-Blue Factory Splices]

Note: It's never a good database design practice to include spaces
within field or control names. Payoff-BlueFactorySplices contains no
spaces and is just as easy to read as Payoff-Blue Factory Splices.

also what about textcontrolname and itemname what values go there?

In place of textcontrolname write the actual name of the text control
in which you wish to display the data. If the name has spaces within
it, i.e. "All my splices", make sure you enclose it within brackets,
[All my splices].


Replace ItemName with whatever it is you wish to enter into the text
control. Enclose it within quotes, i.e. "My Text"

So if we name the text control "All My Splices", the resulting code
would look like:

If Me.[Payoff-Blue Factory Splices] = -1 Then
Me.[All My Splices] = Me.[All My Splices] & "My text" & vbNewLine
Else
Me.[All My Splices] = Replace(Me.[All My Splices],"My text" &
vbNewLine,"")
End If

Each check box name will be different and the ItemText for each will
differ. The text control [All My Splices] will remain the same.

chris

On Thu, 05 Nov 2009 11:12:52 -0800, Repent wrote:

I have a form with many yes/no checkboxes on it.
if the user has had an issue with a particular item, he checkes the
box under that item. I'd then like to have a list box on another part
of the form to list those items the user placed a check next to.

The idea is that the checkboxes the user has to decide on live deep in
the form so if there was a list box of all the items that are checked
on the front of the form, it would make it easier for the user to see
all his choices.

the list box at this point only need to be a listing of those checked
items, one item per line.

how can I do this?

thanks all;

So you just wish to display the items checked as the operator is
entering them ... without saving this data?

Add an unbound text control to the form.
Size it tall enough to display expected data.
Add a vertical scroll bar if you think it might be needed.

Then code the AfterUpdate event of each Check box field:

If Me.CheckName = -1 Then
Me.TextControlName = Me.TextControlName & "ItemName" & vbNewLine
Else
Me.TextControlName = Replace(Me.TextControlName,"ItemName" &
vbNewLine,"")
End If

The appropriate field name will be added to the text control if the
check box is checked.
If the check is later removed from the check box, the Item name will
be removed from the text control.

To clear the check box when navigating to a different record, code the
Form's Current event:
Me.TextControlName = Null
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top