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.
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: