Populated textbox still show old text when text in combobox is deleted

dhewwn

Registered User.
Local time
Tomorrow, 01:30
Joined
Jan 13, 2019
Messages
13
Hi


I tried to populate textbox from combobox and it works. When deleting text in the combobox, the populated textbox will return to null..
Now when i tried to add a new combobox and textbox, the textbox does filter based on the combobox. But the textbox still show the last populated text when the value in the combobox is deleted.
Why is it so?
I tried to recreate the whole form, its old value is still there when it didnt before.

I use 'on change' on the combobox.
me.txt_Text1 = me.cbo_Combo1.Column(2)
 
That looks like it should work. Are there any other code involved? Are you getting any errors?
 
its the same thing? because when i google, they only show put in on change event.
 
its the same thing? because when i google, they only show put in on change event.
So, how exactly are you deleting the content of the combobox?
 
That looks like it should work. Are there any other code involved? Are you getting any errors?


Yeah, there's a filter code for the subform. But its in the after update event.
Which I also did before, and it works alright. Just suddenly the value in the textbox doesnt clear itself. This is a new textbox and combobox that i added in the form, just to clarify. The old one works perfectly.
 
Yeah, there's a filter code for the subform. But its in the after update event.
Which I also did before, and it works alright. Just suddenly the value in the textbox doesnt clear itself.
Can you post a demo version of your db?
 
Sure just let me remove condential info
 
Its in fom_TaxInv.
The correct one is Client Name combobox.
The address and the rest is its populated textbox.


The one with the error is cmb_InvNo.
The populated textbox is Text55.
 

Attachments

Last edited:
Its in fom_TaxInv.
The correct one is Client Name combobox.
The address and the rest is its populated textbox.


The one with the error is cmb_InvNo.
The populated textbox is Text55.
Hi. Thanks. I'm looking at it now and can see what you mean. I'll let you know if I find out why it's happening. Otherwise, we might just devise a workaround for you.
 
Hi. Thanks. I'm looking at it now and can see what you mean. I'll let you know if I find out why it's happening. Otherwise, we might just devise a workaround for you.
Okay, this is very interesting. The only thing I could think of is maybe the control is corrupted. However, I was able to see the same behavior in the working combobox, once in a while. Most of the time, it works fine. But the new combobox, it doesn't work the same, most of the time (it's the opposite).

So, the only workaround I could think of is to use the AfterUpdate event of the combo to clear out the textbox is the combo is empty. Other than that, the filtering of the form is not affected, so even if the textbox is left with something showing in it, the subform data is still correct.
 
Its in fom_TaxInv.
The correct one is Client Name combobox.
The address and the rest is its populated textbox.


The one with the error is cmb_InvNo.
The populated textbox is Text55.

You need to requery the combo box from fom_ClientDetails when saving the new client record. Add the following in red in the Click_Save sub:
Code:
Else
DoCmd.RunCommand acCmdSaveRecord
[COLOR="Red"]If CurrentProject.AllForms("fom_TaxInv").IsLoaded = True Then
       Forms!fom_TaxInv!cmb_ClientName.Requery
End If[/COLOR]
End If

Best,
Jiri
 
Last edited:
You need to requery the combo box from fom_ClientDetails when saving the new client record. Add the following in red in the Click_Save sub:
Code:
Else
DoCmd.RunCommand acCmdSaveRecord
[COLOR=Red]If CurrentProject.AllForms("fom_TaxInv").IsLoaded = True Then
       Forms!fom_TaxInv!cmb_ClientName.Requery
End If[/COLOR]
End If
Best,
Jiri


Nope, its still the same.
 
Okay, this is very interesting. The only thing I could think of is maybe the control is corrupted. However, I was able to see the same behavior in the working combobox, once in a while. Most of the time, it works fine. But the new combobox, it doesn't work the same, most of the time (it's the opposite).

So, the only workaround I could think of is to use the AfterUpdate event of the combo to clear out the textbox is the combo is empty. Other than that, the filtering of the form is not affected, so even if the textbox is left with something showing in it, the subform data is still correct.


How do i type out the code? So there is no way to solve the root, only a workaround?
 
How do i type out the code? So there is no way to solve the root, only a workaround?
Well, if it's a corrupted form or control, part of the solution is to do a C&R or replace the corrupted form or control with a new one. For the workaround, in the AfterUpdate event, you could check if the combo is empty. And if it is, empty the textbox as well. For example:
Code:
If IsNull(Me.ComboName) Then Me.TextboxName=Null
 
Last edited:
ok, i will try to redo the form and see if it works. If not, I guess I will just use the empty code.
Thank you.
 
ok, i will try to redo the form and see if it works. If not, I guess I will just use the empty code.
Thank you.
You're welcome. Good luck. If I run into a better solution, I'll let you know.
 

Users who are viewing this thread

Back
Top Bottom