The main form is unbound, but is there anything in the
LinkMasterFields/LinkChildFields properties of the subform control?
If so, make sure there is a text box in the subform for the field(s)
specified in LinkChildFields. There is a bug in Access 2002 and 2003 that
causes it to crash if LinkChildFields referst to an AccessField type object,
and you can work around it by placing a text box on the subform so it refers
to a Control type object instead.
If that's not the issue, this is probably a corruption. First up, uncheck
the boxes under:
Tools | Options | General | Name AutoCorrect
Explanation of why:
http://members.iinet.net.au/~allenbrowne/bug-03.html
Then compact to get completely rid of this stuff:
Tools | Database Utilities | Compact.
Next, decompile a copy of the database by entering 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"
At this point, you should have a working database. If not, rebuild the
database by following the 6 steps for the first symptom in:
Recovering from Corruption
at:
http://members.iinet.net.au/~allenbrowne/ser-47.html
Let's know at which point you got this solved. I would definately follow
through the decompile and compact anyway.
--
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.
"Tim Marshall" <TI****@antarctic.flowerpots> wrote in message
news:cn**********@coranto.ucs.mun.ca...
Given a bound continuous subform in an unbound main form, a button on the
subform sets allowadditions = true and dataentry = true. This works no
problem.
But a second button on the subform which is meant to switch the the above
off crashes whenever me.dataentry = false is executed. The full code for
the button is:
Private Sub btnOK_Click()
Me.AllowAdditions = False
Me.DataEntry = False 'always crashes at this step
Me.AllowEdits = False
sAddEditEnable False 'a simple proc which enables, disables various
buttons
End Sub
Whether or not the offending line is first or not, Access dies.