- Feature Articles
- CodeSOD
-
Error'd
- Most Recent Articles
- Secret Horror
- Not Impossible
- Monkeys
- Killing Time
- Hypersensitive
- Infallabella
- Doubled Daniel
- It Figures
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
The question that really counts... what code called HoldIt?
Admin
I think Fred Blogs and Duffy should get a room.
Admin
The delay doesn't work - well, not always. The VBA Second function returns the number of seconds into the current minute (i.e. 0-59). Consider if the function is called with a delay of 10 and the current seconds (i.e. past the minute) is 55. Temp will be set to 1, then 2, then 3, then 4, then -55, then -54,... That's never going to be more than 10. That's not even considering that this is a spin loop that's going to consume 100% CPU.
Admin
"Duff" is also British slang meaning "worthless, inferior, or just plain crappy."
Admin
If I read this correctly, Count is a local variable. Since it is not initialized, its value is Empty, and Empty + 1 is Empty. Empty gets coerced to 0 in the comparison operator and we always get the first branch.
Admin
I'm broken. This isn't the frist time.
Admin
This is VB.. So it's very possible that because Count is not initialized when it is Dim-ed, that it is remembered somehow. I recall this happening in for-loops as well. Creating a variable inside the for loop, but not assigning it a value would 'remember' the value from the previous index in the loop. All sorts of stuff happened if you were using it to check for 'Nothing', and you only filled it if a condition was true.
You would expect it to be 'Nothing' if the condition was false, but if the previous iteration of the loop had set it, it would retain that value, and so not be 'Nothing'.
I think SQL still does it that way, but there I somehow expect it more than in VB.
Admin
I wonder what logic where sets the apparently global variable
pboolCloseAccess
? And what does that value represent? If it's true the function can't close Access and if its false the user can optionally close Access.At first I thought it might represent "is this user authorized to close Access? T/F". But if that's the intent the sense is backwards.
And what is the thought process behind setting it to true immediately before issuing a quit command to Access itself? Makes me suspect some kind of half-assed attempt at guarding against a multi-threaded race condition on quitting? The fact the test and set are separated by a user input interaction give a pretty wide time interval for the race condition to occur and NOT be protected.
But if that was the dev's intent, how about naming it something more transparent like
pboolAccessIsAlreadyClosing
. Gaah!Admin
No, Empty + 1 is 1.
The reference page for the + operator states that if one argument is an empty variant and the other argument is not a variant, the non-variant argument is returned as the result. This isn't too surprising since Empty is represented as 0 in numeric context.