Code Stopped working?

Sean25

Registered User.
Local time
Yesterday, 21:15
Joined
Feb 16, 2004
Messages
25
Me, again!

okay, I'm just banging my head repeatedly against a wall here, and I have no idea what the snap is wrong with my code.

It's exactly what was found in the thread regarding Changing a Form's RecordSource, and it worked when I put it in, but suddenly, it's stopped working.

Here's the code found on the Form opening the new form:

DoCmd.OpenForm FormName, acNormal, acEdit, , , , "addCust"

Followed by a number of field attribute changes (enabling and unlocking the text fields, again exactly as pointed out to me in another thread, one field's example code follows:

Forms(FormName)("StoreName").Enabled = True
Forms(FormName)("StoreName").Locked = False

(yes, FormName is the name of the declared string that equals the name of the form that is being opened)

Then, the code contained in the OnOpen Sub of the Form being opened:

If Me.OpenArgs = "lookupCust" Then
Me.RecordSource = "LookupQuery"
' MainMenu.SetFocus
ElseIf Me.OpenArgs = "addCust" Then
Me.RecordSource = "AddQuery"
' Me.DataEntry = True
' StoreName.SetFocus
' DoCmd.GoToRecord , , acNewRec

End If

The extra lines are commented out to see if they were causing the problem, but it made no difference. When I attempt to open the form, I get "The OpenForm action was canceled".

Can anyone explain this?

Thanks for any and all help.

As an aside, the only time the Form opens is when all of it's own Code is removed.

S.
 
Last edited:
Arrrgh!

What a rigamarole!

There was nothing wrong with the code, the form just 'broke' !?!?

Tried compacting and repairing, nothing.
So I copied the form, and renamed it.
Changed the calls to the new form name, and uncommented all the code, and everything works exactly as it should!

GD M$!!

</end rant>

S.
 

Users who are viewing this thread

Back
Top Bottom