tags:

views:

55

answers:

1

I'm at a complete loss, a form just changed behavior on me; it was working and then just stopped for no apparent reason. I'm opening it from a button:

DoCmd.openForm "formName", , , "ID=" & Me.ID

Debug tracing shows that the value is set properly at this point. When the form loads, I need to set a few display items, using the OnCurrent event.

Private sub Form_Current()
    if Me.NewRecord Then

At that point, it says there's no record, debugging info says the recordset is BOF and EOF, as if the query didn't match. But if I run the saved query at that moment, it displays the right info. Furthermore, if I stop the execution, leaving the form open, and then hit the button again, it does load the data properly. I'm stumped.

Edit - After importing the form from a backup, and retyping the changes, the whole problem went away. I'm guessing corruption, but it's a mystery how it can screw up like that.

+1  A: 

Renaming the problem form, and then importing the form from backup fixed it. Renaming is wise if you need to scan for changes since the backup.

Thanks Remou, I had forgotten about the /decompile option too, that might have fixed it.

While I'm answering the question, I should also add: Never run two copies of the frontend forms, whether on the same computer or multiple computers across the network... split your data, and make sure each frontend process has its own copy of the frontend. I think that contributed to the form corruption.

DGM