Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789

    Unanswered: cascading combo boxes error

    Hello I have a Lookup Table that updates a child table through on combo called MERCodes. What happens is the user picks a code such as 7ca or 3ca and it populates 2 two to three fields depending on which the code. I need to add two more colums to the lookup table so that it will update two more fields, the problems I get an error message in my VBA code. Can anyone tell me what I am doing wrong please. I have to add the [StateCategory] and the [StateServicesCovered] also. Both tables have the same fields only one is used to update the other, by doing this it makes it easier and faster for the users to do data entry


    this is my original code:

    Code:
    Private Sub MERCodes_AfterUpdate()
     Me.Catagory_for_hours = Me.MERCodes.Column(2)
     Me.Catagory_for_hours.SetFocus
     Me.Catagory_for_hours.Dropdown
     Me.Services_Covered = Me.MERCodes.Column(3)
     Me.Services_Covered.SetFocus
     Me.Services_Covered.Dropdown
     Me.NameofWorkshop = Me.MERCodes.Column(4)
     Me.NameofWorkshop.SetFocus
     Me.NameofWorkshop.Dropdown
     Me.MERCodes.SetFocus
     
    
    
    End Sub
    Here is the code I added but its giving me an error

    Code:
    Private Sub MERCodes_AfterUpdate()
     Me.Catagory_for_hours = Me.MERCodes.Column(2)
     Me.Catagory_for_hours.SetFocus
     Me.Catagory_for_hours.Dropdown
     Me.Services_Covered = Me.MERCodes.Column(3)
     Me.Services_Covered.SetFocus
     Me.Services_Covered.Dropdown
     Me.NameofWorkshop = Me.MERCodes.Column(4)
     Me.NameofWorkshop.SetFocus
     Me.NameofWorkshop.Dropdown
     Me.StateCategory = Me.MERCodes.Column(5)
     Me.StateCategory.SetFocus
     Me.StateCategory.Dropdown
     Me.StateServicesCovered = Me.MERCodes.Column(6)
     Me.StateServicesCovered.SetFocus
     Me.StateServicesCovered.Dropdown
     Me.MERCodes.SetFocus
     
    
    
    
    End Sub

    Error message
    "compiler error - method or data member not found".

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Which line is giving this error?
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    Well I figured out why I got an error message in my code. field name was spelled incorrectly. this code doesnt give me an error message but now my problem is that the StateCategory and the StateServicesCovered isnt populating when I pick a code like 3a

    the reason why I need those two to populate is for our funding agency The State.
    So when the user picks 3a from a drop down the other fields populate (categoryforhours and ServicesCovered). But the StateCategory and the StateServicesCovered is not populating at all.

    3a is suppose to give

    [Category for hours] = Job Skills Training
    [Services Covered] = Job Skills Training (Supervised)
    [State Category] = Counseling
    [State Services Covered] = Individual -Academic Progress Hours


    Here is the code I am using
    Code:
    Private Sub MERCodes_AfterUpdate()
     Me.Catagory_for_hours = Me.MERCodes.Column(2)
     Me.Catagory_for_hours.SetFocus
     Me.Catagory_for_hours.Dropdown
     Me.Services_Covered = Me.MERCodes.Column(3)
     Me.Services_Covered.SetFocus
     Me.Services_Covered.Dropdown
     Me.NameofWorkshop = Me.MERCodes.Column(4)
     Me.NameofWorkshop.SetFocus
     Me.NameofWorkshop.Dropdown
     Me.State_Catagory = Me.MERCodes.Column(5)
     Me.State_Catagory.SetFocus
     Me.State_Catagory.Dropdown
     Me.State_Services_Covered = Me.MERCodes.Column(6)
     Me.State_Services_Covered.SetFocus
     Me.State_Services_Covered.Dropdown
     Me.MERCodes.SetFocus
    
    
    
    End Sub

  4. #4
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    Does category 3a only have those four columns? If so, that is your problem - you are referring to non-existent column values in your code.
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  5. #5
    Join Date
    Feb 2004
    Location
    Alpine Califormia
    Posts
    1,789
    Wohoo it works finally thank you so much Ken, I changed the properties of the MERCodes drop down the



    ColumnWidths: 0";2";5.0299";0";0";0";5"

    ColumnCount: 7

    and I added the 0",5" to both the StateCategory and the StateServicesCovered



    But what I kept forgetting about the the RowSource of the MERCodes Combobox

    I didnt add the StateCategory and the StateServicesCovered



    RowSource: SELECT CodeID, Codes, CategoryForHours, ServicesCovered, NameOfWorkshop, StateCategory, StateServicesCovered FROM ServCategorylookup_tbl WHERE (Codes IS NOT NULL) ORDER BY Codes

Posting Permissions

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