Combobox with 2 columns needs to update 2 fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • linwork
    New Member
    • Jan 2009
    • 5

    Combobox with 2 columns needs to update 2 fields

    Hi,

    I have a form that updates an issue log. Among the other fields on it, it contains a combobox with 2 columns that I would like to update 2 separate fields in my database.
    ComboErrorDesc displays data 2 fields from my Error table; Error Num and Error which is a description of the error

    I would like it to update 2 fields in my issues table - Error Type and Problem Short. I can currently get it to update Error Type with the Error Num but I can't get it to put the Error into problem short..I know it's probably not the best programming practice to be storing the error description in 2 different places like this, but I would really like to do it if it is possible!

    Thanks again for your help!
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Code:
    Private Sub ComboErrorDesc_AfterUpdate()
         Me.ErrorType = Me.ComboErrorDesc.Column(0)
         Me.ProblemShort = Me.ComboErrorDesc.Column(1)
    End Sub
    Welcome to Bytes!

    Linq ;0)>

    Comment

    • linwork
      New Member
      • Jan 2009
      • 5

      #3
      Thanks for your help linq!

      I am able to get my data to save in the proper fields now...but I am having a problem displaying it. I use the same form to view the data but it doesn't populate that combobox when I try to view it.

      For example this is my Add Modify Form. I use it to add new data or display the current data so I can modify it and then save it. Everything has been working well until now that I added this combobox! Other combo boxes display the item that I chose but this combo box is just blank. It doesn't even show the Error Number that I selected.

      Did I explain this ok? Please let me know if you need more info...basicall y I just want the item that I chose from the list to be populated when I open the form again for that record.

      Comment

      • missinglinq
        Recognized Expert Specialist
        • Nov 2006
        • 3533

        #4
        Are you saying that when you return to a given record the Error Number you chose from the combobox doesn't show in the combobox? That's because the combobox is not bound to a field in your underlying table. Why would you want it to be? You've already stored the Error Number in the table in the ErrorType field, haven't you? You certainly don't need it stored twice in each record.

        But if you just have to have the Error Number show twice on the form, use this code:
        Code:
        Private Sub Form_Current()
            Me.ComboErrorDesc = Me.ErrorType
        End Sub
        Linq ;0)>

        Comment

        Working...