By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

Combobox with 2 columns needs to update 2 fields

P: 5

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!
Jan 26 '09 #1
Share this Question
Share on Google+
3 Replies

Expert 2.5K+
P: 3,532
Expand|Select|Wrap|Line Numbers
  1. Private Sub ComboErrorDesc_AfterUpdate()
  2.      Me.ErrorType = Me.ComboErrorDesc.Column(0)
  3.      Me.ProblemShort = Me.ComboErrorDesc.Column(1)
  4. End Sub
Welcome to Bytes!

Linq ;0)>
Jan 26 '09 #2

P: 5
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...basically I just want the item that I chose from the list to be populated when I open the form again for that record.
Jan 27 '09 #3

Expert 2.5K+
P: 3,532
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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.     Me.ComboErrorDesc = Me.ErrorType
  3. End Sub
Linq ;0)>
Jan 27 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.