Full Version: Problem editing a Text Box inside a form
UtterAccess Forums > Microsoft® Access > Access Forms
mannsi
Hello everybody,
I've got an Access problem with Text Box controlling. I'm sorry if this question has been answered before.
I've got a Text Box that gives me a part of the result from a query of mine. I wan't to be able to edit this result by f.x. having the output of the text box be Yes if the query result was >100 but No if it is =<100.
I've tried to mess with the Control Source in the properties of the text box by adding an IF sentence (which I had no idea how to properly configure) with no luck.
I've also tried to add some code in VBA as seen below
Private Sub Text46_BeforeUpdate(Cancel As Integer)
Dim b As String
b = "bla2"
MsgBox b
Text46 = b
End Sub
Ohoped this would insert 'bla2' into the textbox when I would open the form but that does not happen. But If I put this code behind a button and press the button, 'bla2' is inserted into the text box.
So, if you could either tell me what is wrong with the above code or tell me if I can add an IF sentence somewhere like the control source, that would help me out alot.
Thanks in advance.
ace
Try setting the value of the textbox in the form's Current event.
mannsi
I solved it by simply changing my query to give me the results I wanted.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.