Problem with a Form

B

ByB

Hello,

I am a newbie in VBA, so I'll try to explain my problem :

I have to modify an application which is written in VBA (Access).
There is a form with displays several rows of data obtained from a SQL
Server database.

For that purpose, the form is made of three parts (header, footer, and
the middle part). The middle part shows only one row of controls in
"Creation mode" , but it replicates itself several times when the app
is running, so it can show up to 8 lines of data. It's obviously a
"dynamic" form.

I tried to add one control (a listbox) in "Creation mode" at the end of
the row. When the application is running, I get a listbox at the end of
each 8 rows, but when I try to to select a value in one of the
listboxes, all the listboxes of the form select the same value !

What I really need is that all 8 listboxes are independent from each
other, and that different values can be selected in each of them with
no interference with the others.
Is there some property I need to set to make the listboxes independent
?

I hope my description will make sense, and you'll help me to find a
solution.

Thank you very much for any hint or help !
 
C

Carl Rapson

ByB said:
Hello,

I am a newbie in VBA, so I'll try to explain my problem :

I have to modify an application which is written in VBA (Access).
There is a form with displays several rows of data obtained from a SQL
Server database.

For that purpose, the form is made of three parts (header, footer, and the
middle part). The middle part shows only one row of controls in "Creation
mode" , but it replicates itself several times when the app is running, so
it can show up to 8 lines of data. It's obviously a "dynamic" form.

I tried to add one control (a listbox) in "Creation mode" at the end of
the row. When the application is running, I get a listbox at the end of
each 8 rows, but when I try to to select a value in one of the listboxes,
all the listboxes of the form select the same value !

What I really need is that all 8 listboxes are independent from each
other, and that different values can be selected in each of them with no
interference with the others.
Is there some property I need to set to make the listboxes independent ?

I hope my description will make sense, and you'll help me to find a
solution.

Thank you very much for any hint or help !

That's more accurately called a "continuous" form. And you've run into one
of the limitations of continuous forms. Despite what it looks like, in a
continuous form there is really only one instance of each control, it's just
repeated for each record being displayed. When the control is bound to a
field in the record source, it will display the value for each record (as
you can see). Unbound controls, however, only exist once and thus when you
make a selection in one record it shows in all records. It sounds like your
newly-added control is unbound. Check the control's Control Source property.

What is the purpose of this unbound control on your form? If it doesn't
correspond to any data in the underlying database, why is it there? If it's
something that needs to be stored in the database, it should be bound to a
field.

Carl Rapson
 
B

ByB

That's more accurately called a "continuous" form. And you've run into one of
the limitations of continuous forms. Despite what it looks like, in a
continuous form there is really only one instance of each control, it's just
repeated for each record being displayed. When the control is bound to a
field in the record source, it will display the value for each record (as you
can see). Unbound controls, however, only exist once and thus when you make a
selection in one record it shows in all records. It sounds like your
newly-added control is unbound. Check the control's Control Source property.
What is the purpose of this unbound control on your form? If it doesn't
correspond to any data in the underlying database, why is it there? If it's
something that needs to be stored in the database, it should be bound to a
field.
Carl Rapson

Thank you for your clear answer. I think this is indeed the problem.

The control I am trying to add is a ListBox (for each line of the form)
to add a specific property to the information reflected by the data,
but this information is not stored in the same tables that the
continuous form uses. In fact, each line of data represents information
about one specific projet, and the listbox is supposed to say something
specific about each project.

Finally, I managed to put only one listbox in the footer of the form,
and when the user clicks on the line representing one project, I set
the listbox value accordingly to this project.

Thank you anyway for the information you gave me.
 
C

Carl Rapson

ByB said:
Thank you for your clear answer. I think this is indeed the problem.

The control I am trying to add is a ListBox (for each line of the form) to
add a specific property to the information reflected by the data, but this
information is not stored in the same tables that the continuous form
uses. In fact, each line of data represents information about one specific
projet, and the listbox is supposed to say something specific about each
project.

Finally, I managed to put only one listbox in the footer of the form, and
when the user clicks on the line representing one project, I set the
listbox value accordingly to this project.

Thank you anyway for the information you gave me.

You're welcome, and you came up with a good solution to your problem.
Another is to use a "popup" form to enter the additional information.

Carl Rapson
 

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