list box question

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

I have code that adds text to a list box in the form yet when I go back into
the form the list box is blank yet the data is saved in the table.

Also if I add information to a form text box to the list box the data
appears on all the form records rather than just the record the data was
entered on.
 
I have a value list, I have never hear of the NotinList event. I have a
button with an on click event to add the text box to the list box. However
when I go back into the form the entry is not in the list box but is
displayed on the table.
 
Rpettis31 said:
I have a value list, I have never hear of the NotinList event. I have a
button with an on click event to add the text box to the list box.
However
when I go back into the form the entry is not in the list box but is
displayed on the table.


Adding some thing to the list of items displayed by a list box has no effect
on the field to which the list box is bound.

I think you're confused about list boxes and how they work. A list box
displays a list as defined by its Row Source, and allows you to select one
or more items from the list. If the list box is set to allow you to select
only a single item, then the list box can be bound to a field in your form's
Record Source, and the value of the selected item will be stored in that
field. If the list box allows you to select multiple items, then it can't
be bound to a field and anything that is to be done with the selected items
must be done with your own code.

No amount of adding items to the list box's Row Source will affect the field
to which its bound.
 
I was looking to do a status update where basically the user would type
information and it would appear in the list box. For example 9/4/08 case
opened.

Then at a later time the as the status is updated new notes can be entered.

This is from a text box and entered into the list box.

Basically a form is made in add mode to create the issue.
In this form there is a follow up tab that ppl can go to to add notes later
when they view the records through the form (view mode).

I can currently add notes to the list box but when I leave the database and
return back to the same record the data is not there.
 
Rpettis31 said:
I was looking to do a status update where basically the user would type
information and it would appear in the list box. For example 9/4/08 case
opened.

Then at a later time the as the status is updated new notes can be
entered.

This is from a text box and entered into the list box.

Basically a form is made in add mode to create the issue.
In this form there is a follow up tab that ppl can go to to add notes
later
when they view the records through the form (view mode).

I can currently add notes to the list box but when I leave the database
and
return back to the same record the data is not there.


A list box is not appropriate for this. As I said before, adding notes to
the list box does *nothing* to add them to your database.

You can either use a memo field in the form's underlying table to hold the
notes, and a text box to display them, or you can have a separate, related
table of notes and use a subform to display and, usually, add them. If you
want to use a single memo field in the main table, you can use code to enter
each note on a new line, prefixed by the date if you like. Such code would
look like this:

Me.Notes = (Me.Notes + vbCrLf) & Date & " - " & Me.txtAddNote

That will add a new line before the new note, unless the Notes field is
currently Null.
 
Back
Top