Filed Under (Visual FoxPro, work.BLOG) by WildFire on 15-08-2004

Peculiar things happen once in a while in a programming language IDE and the VisualFoxpro's IDE is not an exception.

Take this for an example:

close databases
close all

select 0
use FILEAREA shared
if !file('FILEAREA.cdx')
index on upper(alltrim(AREA)) tag CAREAREA

Note: UDF NUMTOSTR(5, 3) returns '005'
Note: UDF is 'User Defined Function' (OK... you know that already)

So what is wrong with the above snippet?

Nothing really. In fact I'm using it on a different application and it's fine. But tonight I'm getting the 'File must be opened exclusively.' error message. So I tried transferring it from the .PRG file to the frm.Init, removed the NUMTOSTR line temporarily, executed close all commands inside the command window, closed VisualFoxpro a couple of times and the error is still there.

No other application is using the database and I'm not even connected t0 the internet. (Just in case you're entertaining that wild idea that someone in cyberspace is playing with my databases tonight)

So I thought 'FILEAREA' was an ultra-secret Foxpro reserved word and renamed the database to AREA.

Still, the problem exists.

Another reboot, fired up VisualFoxpro, executed the program and it ran sans the error message this time.


So I tried recoding the things I made, re-used the NUMTSTR function, renamed the database back to FILEAREA and placed the code back to the DatabaseInitialization.prg.

Problem's lost... I can't even recreate it.

This is one of those weird stuff I encounter once in a while. You can't even share it to someone whose skills are better than yours since it just disappeared out of nowhere. As a programmer this is quite puzzling. Programmers always have this inner desire to know the why and how of things. Why such thing exists. Why it exists that way.

When you can't recreate the problem, you can't prove that the problem isolation procedures you just did were the solution... that you used the right chant and growl frequencies.

You can't even prove that such problem exists.

Really weird. You just end up storing it somewhere behind some portal deep within your brain...

... or you end up blogging about it.