Results 1 to 12 of 12
  1. #1
    Join Date
    Jan 2008
    Posts
    114

    Unanswered: Adding dependent combos to an existing form...

    Hi
    I have got one combo box that shows the client name, when a name is chosen the second combo updates to show only that clients meds.. It works great.
    Info is pulled from tbl_Clients and tbl_Medications respectively.

    How can I add these results to another table called tbl_Medincidents?
    If I use tbl_MedIncidents as the Forms record source my combos dont affect any fields.

    Im wondering how to tie the existing tblMedIncidents with my 2 combo boxes?

    Anyone have any idea?

    Thank you very much

    Tracy
    Last edited by Gwyar; 07-22-10 at 11:06.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    It sounds like if you set their control source properties to the applicable fields in tblMedIncidents it should work.
    Paul

  3. #3
    Join Date
    Jan 2008
    Posts
    114
    Thank you pbaldy.
    I fiddled for a while and now it works great/.. thank you

    For the last hour I have been trying to add a txt box to the form that will display the dose.
    So I choose the client, their meds auto populate the 2nd combo and the dose populates the txt box.

    I have done something wrong, cos when I add a new client, the dose disappears from the previous record.
    It seems there can only be one dose on the form at a time.
    Quite confused...

    Any ideas?

    Thanks much

    Tracy

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Is the textbox bound to a field in the underlying table?
    Paul

  5. #5
    Join Date
    Jan 2008
    Posts
    114
    Well.. Not exactly, this is in the Control Source:
    =[Med_Combo].[column](1)

    Tracy

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Sorry Tracy, I lost track of this thread. Did you get it sorted out?
    Paul

  7. #7
    Join Date
    Jan 2008
    Posts
    114
    Thats ok.. I am still struggling with it...

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Well, since the control source isn't a field in the table, the value won't be saved anywhere. Does it have to be, or can it be derived from the combo? If it has to be, then you'd have code in the after update event of the combo to set the value of a bound textbox to the same value you currently use for display:

    Me.TextboxName = [Med_Combo].[column](1)
    Paul

  9. #9
    Join Date
    Jan 2008
    Posts
    114
    Hi again.
    Well I now have this in the After Update:

    Private Sub txtDose_AfterUpdate()
    Me.TextboxName = [Med_Combo].[Column](1)
    End Sub

    But it doesnt do anything..
    Must be doing something wrong...

    Tracy

  10. #10
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I mentioned the after update event of the combo. Try this:

    Me.txtDose = [Med_Combo].[Column](1)

    In the after update event of Med_Combo.
    Paul

  11. #11
    Join Date
    Jan 2008
    Posts
    114
    YAY....
    Thank you, Thank you Thank you
    It now works great.

    Cheers

  12. #12
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Excellent! Happy to help Tracy.
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •