Solved change any code color to red (1 Viewer)

Safari

Member
Local time
Tomorrow, 00:32
Joined
Jun 14, 2021
Messages
95
when i am trying to write vba code its automatically change font color to red and not accepted to complete the code also refuse to get any text property like :
me. not open the properties combo box .

how can i solve it
 

Attachments

  • Untitled.png
    Untitled.png
    3.8 KB · Views: 182

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:32
Joined
Aug 30, 2003
Messages
36,118
Do you have a form open with a timer event running behind it?
 

Safari

Member
Local time
Tomorrow, 00:32
Joined
Jun 14, 2021
Messages
95
Do you have a form open with a timer event running behind it?
Yes i have its the main form i made digital form on it .

What can I do?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:32
Joined
Aug 30, 2003
Messages
36,118
That code causes this issue. Either close that form, put it in design view, or temporarily take out the timer event code while you're developing.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 15:32
Joined
Aug 30, 2003
Messages
36,118
That is "the usual suspect" so I think you'll be fine. Basically you just have to stop that timer in one way or another while you're developing.
 

Mike Krailo

Well-known member
Local time
Today, 18:32
Joined
Mar 28, 2020
Messages
1,030
@pbaldy I'm not familiar with this particular problem, is this something that can be demonstrated? It would be nice to see an example of this issue.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:32
Joined
Feb 19, 2002
Messages
42,976
Timers interfere with code. If your application uses them, it is imperative that you code yourself a way to turn them all off when you are developing. Obviously, you need them on for testing but I have my start up form prompt me (by checking who logged in) so I don't forget to turn them off. The login form automatically turns them back on when it closes so I don't forget to do it.

I also have code that raises an error message if it is NOT me and the timers are NOT enabled and then refuses to open the database.
 

Mike Krailo

Well-known member
Local time
Today, 18:32
Joined
Mar 28, 2020
Messages
1,030
Timers interfere with code.
But how exactly? Is there a simple demo of this problem somewhere? I have lot's of code that uses timers in various projects and have never seen this before. Maybe because when I work on the code, all the forms are in design view, I don't really understand what steps to take to duplicate the problem.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:32
Joined
Feb 19, 2002
Messages
42,976
Open a form with a timer so it is running and work on some other form. Frequently the timers are in the menu or login form so you can't actually test with them in design view so you have to have a way to just turn off the timers.
 

Mike Krailo

Well-known member
Local time
Today, 18:32
Joined
Mar 28, 2020
Messages
1,030
Open a form with a timer so it is running and work on some other form. Frequently the timers are in the menu or login form so you can't actually test with them in design view so you have to have a way to just turn off the timers.
Thank you Pat, that was very simple to duplicate and now I see exactly how to avoid that in the future.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:32
Joined
Feb 19, 2002
Messages
42,976
If you want my code for turning off the timers, I'll dig it out.
 

Mike Krailo

Well-known member
Local time
Today, 18:32
Joined
Mar 28, 2020
Messages
1,030
If you want my code for turning off the timers, I'll dig it out.
That's not necessary, but I appreciate the offer. I just finished updating my notes on this issue and played around with duplicating the problem. I think I did see this in the past but didn't understand what was going on at the time. Now I know.
 

Users who are viewing this thread

Top Bottom