Re: Form does no longer bind to table



The symptoms you describe indicate that the form has become corrupt, but
there are ways to try to rescue it. Try this sequence.

1. Make a backup so you get multiple chances at recovery.

2. If you can open the module of the form, make a copy of the text there. If
you do have to recreate the form from scratch, you would then paste this
text back in, and not have to re-write all code from scratch.

3. Make sure that the Name AutoCorrect boxes are unchecked under:
Tools | Options | General
Explanation:
http://allenbrowne.com/bug-03.html
Then compact the database to get completely rid of this stuff.

4. Close Access and decompile the database. This dumps the compiled version
of the code, and VBA will later create it from the text. To decompile, enter
something like this at the command prompt while Access is not running. It is
all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"
Then compact again.
At this point you can test the form to see if it is working yet.

5. If still broken, try to export the form to a text file, using the
undocumented SaveAsText. This kind of thing:
SaveAsText acForm, "Form1", "C:\Form1.txt"
If that fails, the form is generally beyond simple repair. If it succeeds,
create a new (blank) database, turn off Name AutoCorrect, and import all the
*other* objects from your database. Then try loading this form from the text
file:
LoadFromText acForm, "Form1", "C:\Form1.txt"

6. If the form is still broken, create it again from scratch in the new
database created at step 5, and paste in the code you saved at step 2.

For suggestions on how to avoid the database corrupting in future, see:
Preventing Corruption
at:
http://allenbrowne.com/ser-25.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jxrn Nystad" <jorn.nystad@xxxxxxxxxx> wrote in message
news:u3xwjJMnFHA.2904@xxxxxxxxxxxxxxxxxxxxxxx
>
> I have a strange problem with my Access 2000 db.
> Its a multiuser environment with backend and frontend mdb files.
> Backend has only tables and frontend have all the forms, queries and code.
> I'm only using VBA code and no macros.
> Average 6 users using the system at the same time.
> I have made noe relations between tables.
>
> Now to the problem.
> A form with datasource set directly to a table does not bind to the data
> in the table anymore.
> The form has only default settings in the data tab of the properties
> window.
> The form is modal.
> The form ('cause of many fields in the table) has a lot of controls. Prob
> around 30 or so.
>
> I use
> DoCmd.Openform "Myform", , , "[SD_PR_ID] = " & CStr(Me!PR_ID)
> to open the form.
>
> in MyForm_Open() i have some code to fill a unbound label.
> In MyForm_Current() i have som formatting code.
>
> The form does not bind without filter either. Like this:
> DoCmd.Openform "Myform"
>
> And thats about it.
> After editing a command button in the form i compiled the VBA code and
> runned "Compress and repair".
> Then the form refused to bind to the table.
> The old version is working, but ive done so much editing that i would like
> to get the newest version to work.
>
> Anyone experienced this before?
> I've tried everything i could think of. Do i really have to build a new
> form?
>
> Any help would be appreciated.
>
> --
> Jxrn Nystad
> Oslo, Norway


.