Combobox values as query releted to current record

  • Thread starter greeknl via AccessMonster.com
  • Start date
G

greeknl via AccessMonster.com

Is it possible to populate a combobox (just to show related data, not for
selection) on a subform. And in such a way that in datasheet view the
combobox when clicked show the data for the relevant record of the subform.
The subform is related to the mainform of course.

Just a mindgame, suppose I have a mainform which displays persons who own
farms. On the subform all the farms are listed in datasheetview with some
related info. Now I would like to add a combobox which when pressed displays
the animal groups (dogs, cats, pigs, cows etc.) which are living on that
particular farm, so when you go to the next farm of the same person the list
differs.
I have one table with animal and one with the farms and I have a
junctiontable in which the farmid and animalid are stored to create unique
pairs and I have a table with persons. In the farms table the owner is stored

can this be done and if so how.
It might be simple but I am stuck, Thank you
 
C

Carl Rapson

greeknl via AccessMonster.com said:
Is it possible to populate a combobox (just to show related data, not for
selection) on a subform. And in such a way that in datasheet view the
combobox when clicked show the data for the relevant record of the
subform.
The subform is related to the mainform of course.

Just a mindgame, suppose I have a mainform which displays persons who own
farms. On the subform all the farms are listed in datasheetview with some
related info. Now I would like to add a combobox which when pressed
displays
the animal groups (dogs, cats, pigs, cows etc.) which are living on that
particular farm, so when you go to the next farm of the same person the
list
differs.
I have one table with animal and one with the farms and I have a
junctiontable in which the farmid and animalid are stored to create unique
pairs and I have a table with persons. In the farms table the owner is
stored

can this be done and if so how.
It might be simple but I am stuck, Thank you

In the Current event of the farm subform you should be able to populate a
combo box with the animal values from the junction table. You might want to
consider a list box instead of a combo box. You could also do it with an
animal subform embedded on the farm subform, which is itself embedded on the
main form.

Carl Rapson
 
G

greeknl via AccessMonster.com

Thank you,
BUT I have my subform as datasheet view so on every line there should be a
combobox and when selected the combobox should present the data relevant to
the record
Is that possible, even with VBA


Carl said:
Is it possible to populate a combobox (just to show related data, not for
selection) on a subform. And in such a way that in datasheet view the
[quoted text clipped - 17 lines]
can this be done and if so how.
It might be simple but I am stuck, Thank you

In the Current event of the farm subform you should be able to populate a
combo box with the animal values from the junction table. You might want to
consider a list box instead of a combo box. You could also do it with an
animal subform embedded on the farm subform, which is itself embedded on the
main form.

Carl Rapson
 
G

Guest

Try a popup form that has criteria in query from the field in the subform.
The popup is triggered by doulble clicking the field to call an event or
macro.
 
C

Carl Rapson

Ah, I missed the part about Datasheet view. I don't think that's possible in
Datasheet view. Perhaps you could use Continuous Form view instead? I
believe that view might give you more flexibility while still looking like
Datasheet view.

Carl Rapson

greeknl via AccessMonster.com said:
Thank you,
BUT I have my subform as datasheet view so on every line there should be a
combobox and when selected the combobox should present the data relevant
to
the record
Is that possible, even with VBA


Carl said:
Is it possible to populate a combobox (just to show related data, not
for
selection) on a subform. And in such a way that in datasheet view the
[quoted text clipped - 17 lines]
can this be done and if so how.
It might be simple but I am stuck, Thank you

In the Current event of the farm subform you should be able to populate a
combo box with the animal values from the junction table. You might want
to
consider a list box instead of a combo box. You could also do it with an
animal subform embedded on the farm subform, which is itself embedded on
the
main form.

Carl Rapson
 
G

greeknl via AccessMonster.com

Thanks I will try that,
but what are the vba codes to get the current active person on the main form
and the current farm(associated with doubbleclicked detail I want) in VBA in
order to have the relevant data to create a query

KARL said:
Try a popup form that has criteria in query from the field in the subform.
The popup is triggered by doulble clicking the field to call an event or
macro.
Is it possible to populate a combobox (just to show related data, not for
selection) on a subform. And in such a way that in datasheet view the
[quoted text clipped - 13 lines]
can this be done and if so how.
It might be simple but I am stuck, Thank you
 

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