Suddenly, I spot it.
There's this procedure, see, where I pass the database a record ID and some data to write. If this is a new record, I send a 0, otherwise, an existing ID. The database, as programmed by the folks upstairs, then either creates a new record or updates an existing one, as appropriate, and sends me back the new record ID (either a completely new value for a new record, or just echoing back the ID I sent them, for an existing record). I then take this new ID and use it to do all sorts of fascinating other procedures tied to that record.
Pretty basic sort of programming stuff, right? So you might think!
Little did I know that the db folks, for reasons known only to them (if indeed they know themselves), aren't following this plan, at least, not all of it. It turns out that if the record exists already, instead of spitting out the existing record ID, they're sending me back a value of "".
So my procedures are creating/modifying/generally tinkering with all sorts of orphan data now, because it never once occurred to me that I might be sending my procedures a value of "". I assumed, like a chump, that I was sending proper record IDs!
Well, it's an easy enough thing to fix once the problem is diagnosed. A straightforward:
if VARIABLES.recordID IS "" set VARIABLES.recordID = FORM.recordID
...makes all of the rest of my procedures sing and dance like the celestial spheres! For want of these two little lines, my pages have been sending me nasty and arcane error messages, behaving in peculiar ways, and generally making your ever-lovin' blue-eyed Gneech's life hell. Arrgh!
Well, as you can imagine, I'm tremendously relieved now, and positively beaming with energy and goodwill towards one and all ... with the possible exception of the DB guy upstairs who neglected to TELL me that the procedure wasn't working as advertised.
Among other things, I'm hoping that getting this weight off of my mind will free up my creativity a bit, so I can come up with Monday's punchline, do some heavy-duty scripting, and generally start doing art again like a bat out of hell. I sure could use the boost!