Re: Populating a form from combo box



On Jun 11, 5:52 pm, Klatuu <Kla...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Why do you have a separate table for each topic?
What you really should have is one table with a field that identifies the
topic.
Then all you would need to do is include a reference to the combo box in the
subform's record source.
Make the record source a query on the table and in the Topic Field, use the
criteria
Forms!MyFormName!MyComboBoxName

What you are doing will only make things harder for you.
--
Dave Hargis, Microsoft Access MVP



"Carlos1815" wrote:
I have a form with a combo box that has a row source of a table
containing topic titles.  On this form I have a sub form where a user
can add data to a topic.  What I'd like to have is to have the user
choose a topic from the combo box, and have the subform populated with
the data from the topic (a separate table for each topic) chosen in
the cbo box.  This way, I can avoid having 18 separate subforms, just
one form with a subform that allows the user to enter data into one of
18 chosen topics (tables).

Is there a way to do this?  I've looked, and most of the advice given
was populating a form from a combo box using data from the same table
used by the cbo box, not a different table.

Thanks!

Carlos- Hide quoted text -

- Show quoted text -

I understand, this is my first project and I'm really starting to see
where my mistakes are and how they affect the project. However, I'm
kind of at a point of no return with this project, so I just need to
make what I have work as best as I can. The reason why I have a
separate table for each topic is that the designers who will use this
project want the ability to shuffle the pages around which requires a
resort of the pageID's since I didn't want to actually move the data
around; this would be exceedingly more difficult with multiple topics
having multiple pages that need to be sorted on one table. At least,
that sounds well beyond my pay grade... ;)

For my original question, I used this code:

Private Sub Topic_Name_AfterUpdate()

If Not IsNull(Me.Topic_Name) Then
Select Case Me.Topic_Name
Case 1
Me.subfrmTopic1.Form.RecordSource = "Topic1"
Case 2
Me.subfrmTopic1.Form.RecordSource = "Topic2"
Case 3 ... (etc. for each topic)

End Select
End If
End Sub

and this works just as I described I wanted to work.

Carlos
.



Relevant Pages

  • Re: Populating a form from combo box
    ... The shuffling of pages could be done within one ... Private Sub Topic_Name_AfterUpdate ... choose a topic from the combo box, and have the subform populated with ... This way, I can avoid having 18 separate subforms, just ...
    (microsoft.public.access.forms)
  • Re: Text box input based on a combo box selection
    ... user selects the shift for which the inventory is being taken. ... subform are bound to separate tables. ... Private Sub cboShift_AfterUpdate ...
    (microsoft.public.access.formscoding)
  • Re: Text box input based on a combo box selection
    ... user selects the shift for which the inventory is being taken. ... subform are bound to separate tables. ... Private Sub cmbShiftPattern_Change ...
    (microsoft.public.access.formscoding)
  • Re: Error 3048 "Cannot open any more databases"
    ... I'm not sure where the code above runs - is it the main form or the subform? ... check the filter string to see if it looks OK ... Private Sub Form_Current ... Dim rst As DAO.Recordset ...
    (microsoft.public.access.formscoding)
  • RE: error 3162 in text box
    ... or the Tool Number on the sub form? ... that once you move to the subform, the database will attempt to update the ... any other data type, ... and After Update events of the control where you enter a new job number. ...
    (microsoft.public.access.formscoding)