text box not refreshing with vba code (1 Viewer)

vba_php

Forum Troll
Local time
Yesterday, 21:58
Joined
Oct 6, 2019
Messages
2,880
hi everyone,


I thought I knew plenty about access but apparently not! I have the following code if an error occurs:
Code:
        'show the error
         Text2 = GetErr(Err.LastDllError)

         'highlight the error message
         Me.Text2.BackColor = RGB(255, 0, 0)
but at the beginning of the routine, I have this code:
Code:
'clear any previous error messages
Me.Text2.BackColor = RGB(255, 255, 255)
Me.Text2 = ""
Me.Text2.Requery
I don't believe that "requery" is even necessary for textboxes, is it? Regardless though, the box is not turning white at the start of the routine like it should. Can someone point out what I'm doing wrong?


edit
====================
upon further testing, I find that the box is only not changing when I click the connect button and do not change any values in the FTP host name, username, or password boxes. But this should not matter if my code is behind the button's press event. And I changed the rgb() code to 255, 255, 255, which is white. I had it set to black previously.
 
Last edited:

Minty

AWF VIP
Local time
Today, 03:58
Joined
Jul 26, 2013
Messages
10,366
I think you may need to issue a repaint, depending on what event you are calling this from?
 

vba_php

Forum Troll
Local time
Yesterday, 21:58
Joined
Oct 6, 2019
Messages
2,880
repaint did the trick! I guess I must haven't used it in a while.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:58
Joined
Oct 29, 2018
Messages
21,453
I don't believe that "requery" is even necessary for textboxes, is it?
And regarding this question, yes, you can use Requery on a Textbox if it is bound to a field in your table or a column in your query. Cheers!
 

Users who are viewing this thread

Top Bottom