In MS Access assigning a string literal will sometimes result in an empty String
The following code
Public Sub test()
Dim myString As String
myString = "UPDATE "
Debug.Print "'" & myString & "'"
End Sub
results in
''
this is freaking me out. It only happens sometimes. Other times the "UPDATE " will work, but myString = "tblCategorie" won't. It needs to be exactly that String. If "UPDATE " fails, then "update " will still be okay.
I'm using MS Access 2003 11.8204.8221 SP3 Does anyone have the same problem?
(before you say: dump access! we're already doing that, but still in a transitional phase. I'm not really expecting anyone to come up with a decent answer, but a guy can hope)
[UPDATE]: Thanks for all the comments! let me just put really clear though that
- it's not a typo. The same code sometimes works, and sometimes doesn't.
- It's run in isolation so it's no global variable problem.
- I have updated the sample to be the exact code that fails/doesn't fail. It's a literal copy. I test it by pasting it in a module and typing 'test' in the direct screen.
- It first popped up in code that had worked flawlessly the past half year,
- It is really the string assignment that fails (I can check that by putting a break on the assignment statement)
- I generate my database from text exports, so it can't really be a corruption problem. (It could be, but it's not one that I can fix by compressing etc.)