| Gotcha!'s |
![]() |
| Links to Check Out: |
| My Info: |
| Dayton Livingston |
| Name: |
| Email: |
| Gotcha #1 - Microsoft Office 97: I'm sure that everyone's aware of this one by now, but on the off chance that you're not, I figured I'd better mention it. If you are using Microsoft Office 97, and do not have the Service Release 1 (SR-1) update, stop whatever you're doing and get it now. Do not wait. There are a number of very nasty "gotchas" in the original release of Office 97 that could cost you - literally. You can get the full story at Woody's Office Watch (There's a Link at the top of this page). |
| Gotcha #2 - Microsoft Office 2000: One of my pet peeves with Access 97 was that it didn't have a ROUND function built in. Access 2000 does have a ROUND function built in. But it may not work as you would expect in some instances. It appears to have difficulty when the integer portion is an even number, and the fraction is exactly .5. You can test this in the IMMEDIATE pane with the following line of code: For x = 1 to 6 step .5:? x & " = " & round(x):next The results are as follow: 1.5 = 2 2 = 2 2.5 = 2 3 = 3 3.5 = 4 4 = 4 4.5 = 4 5 = 5 5.5 = 6 I could be wrong. Maybe Microsoft knows some special rules about rounding that I don't? At any rate, we stuck to the function I developed for rounding in Access 97. This same bug exists in Excel's ROUND function in VBA, but does NOT occur in Excel's ROUND formula used in spreadsheets. Thus I suspect it's an actual BUG, not just a way of getting more correct rounding. |
| Gotcha #3 - Microsoft Office 2000: In VBA, the value of FALSE is 0, and the value of TRUE is -1. However, anything other than 0 will serve as TRUE. The FONTBOLD property of a Form control doesn not return 0/-1. Instead, it returns 0/1. This would be fine, except that if you're trying to reverse it with the one-line bit of code: Me.Control.FontBold = Not Me.Control.FontBold then it won't work as expected, because: Not 0 = -1 (This is okay) Not 1 = -2 (Anything other than 0 is considered TRUE) The result is that if it's set to TRUE (1) initially, it will remain TRUE (-2) after the code is run. A workaround would be to adjust the code by multiplying by -1 before NOT-ting, then the code will do what you expect: Me.Control.FontBold = Not (Me.Control.FontBold * -1) |
| Gotcha #4 - Microsoft Excel 2000: There is a bug in Excel which causes a severe slow-down of code execution if the code modifies the properties of many rows and/or columns. This includes hiding rows/columns. This problem is addressed in MSKB Article 199505. The problem is tied to the setting regarding whether or not to Show Page Breaks (File|PageSetup). If this is set to TRUE, then the slowdown occurrs. This can be corrected in code by saving the setting, turning it off, running your code, then restoring it to the saved value, as follows: Dim blnDispPgBrk as Boolean blnDispPgBrk = Activesheet.DisplayPageBreaks 'Save Activesheet.DisplayPageBreaks = False 'Turn Off (Your Code Here) Activesheet.DisplayPageBreaks = blnDispPgBrk 'Restore |