ComboBox and TextBox combination

Diango

Registered User.
Local time
Today, 08:06
Joined
Sep 6, 2007
Messages
19
I have a comboBox which has Degree types, when I drop down the comboBox and I select one, it shows in my TextBox

What I want is the following:

Right now, through the same TextBox I use I'm able to enter a new Degree Type into the database. But what I haven't been able to do is that I haven't been able to show that "NEW" value immediatly on the ComboBox without me having to drop down and select it. Is there a way to have the value show without having to dropdown?
 
I have a comboBox which has Degree types, when I drop down the comboBox and I select one, it shows in my TextBox
I would assume you are talking about an AfterUpdate event for your combo box here.
Right now, through the same TextBox I use I'm able to enter a new Degree Type into the database.
This tells me that the text box is bound to the table.
But what I haven't been able to do is that I haven't been able to show that "NEW" value immediatly on the ComboBox without me having to drop down and select it. Is there a way to have the value show without having to dropdown?
This tells me that you are wanting to see the value that was just entered into the table (by the textbox), in the combo box. If so, why don't you just set the combo's value in code before the new value is entered into the table?

I'm really tired right now, so I'm not sure I answered this correctly. But hey, mixing combos and txtbxs are great fun! The sample I attached shows a bit of brain teasing nonsense with regard to mixing text boxes and combo boxes together. You can see it if you click around from control to control on the form...
 

Attachments

None of my controls are bound. The way I'm able to insert the new value from the textbox into the database is by using the CurrentDb.Execute Command. The ComboBox gets its data from the RowSource property that I have attached to a query.

So Once I enter a new value into the textBox and I run the CurrentDb.Execute command to insert the new value, I want it to be shown on my ComboBox right away.
 
The way I'm able to insert the new value from the textbox into the database is by using the CurrentDb.Execute Command.
OK, understood.
So Once I enter a new value into the textBox and I run the CurrentDb.Execute command to insert the new value, I want it to be shown on my ComboBox right away.
So, then why couldn't you just store the txtbox value in a variable before you execute the command? Either that, or populate the cbobox before the command is executed?? Maybe either of these:
Code:
Sub On Event

  me.comboboxname = me.textboxname
    currentdb.execute ([I]whatever you are doing)[/I])

End Sub
OR...
Code:
Sub On Event

  dim x as (string) - [I](e.g. the data type of the txtbox value)[/I]

    x = me.textboxname
      [i]currentdb.execute...[/i]
        me.comboboxname = x
          [I][U]do you need a .REQUERY here for your combo box?  (just wondering)[/U][/I]

End Sub
 
thanks, I'll try this out now. I'm not sure if I have to requery, but we'll find out soon enough :)
 
Thanks for all your help. Everything seems to be working beautifully now!
 

Users who are viewing this thread

Back
Top Bottom