Why form set to allow addition will allow additions?

I have a form in continuous mode that I have set to allow additions = No in the properties of the form but when the form opens it still allows additions.  ???

Here's the code that opens the form:

DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'", acFormEdit, acWindowNormal
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eric ShermanAccountant/DeveloperCommented:
Just as a test ... Try this code and report back what happens.

DoCmd.OpenForm "frmTasksContinuous",,, "[Priority]= '" & Me.txtPriority & "'"

ET
SteveL13Author Commented:
I can still add a record.
Rey Obrero (Capricorn1)Commented:
check your codes for anything that set the form's allow addition to yes
look in the Open and Load event of the form "frmTasksContinuous"
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Jeffrey CoachmanMIS LiasonCommented:
Is this a mainform/subform?
In other words,  are your setting this property on the subform and wanting it o affect the main form? ...or vice versa?
Jeffrey CoachmanMIS LiasonCommented:
Is this a mainform/subform?
In other words,  are your setting this property on the subform and wanting it to affect the main form? ...or vice versa?
Rey Obrero (Capricorn1)Commented:
check your codes for anything that set the form's allow addition to yes
 look in the Open , Load , activate and Current event of the form "frmTasksContinuous"
SteveL13Author Commented:
This is a main form with no subform.  There are no events taking place such as onopen, onload, activate, current.  Nothing.  Is very strange.  If it matters the record source is a query.
Rey Obrero (Capricorn1)Commented:
can you upload a copy of the db?
SteveL13Author Commented:
I'll strip it down and post it.
SteveL13Author Commented:
Here you go.

Open frmTaskReportDateRange
Enter 7/1/2015 through 7/31/2015
In the option group select "All"
Click [Task List - All]

I think you will see what I mean.

But if you open frmTasksContinuous after filling in the form frmTaskReportDateRange
 it works perfectly.  You cannot add a record.
Sample.accdb
Eric ShermanAccountant/DeveloperCommented:
This worked for me ... If you want to allow edits ... Then set the AllowEdits property of your Form to True.

Private Sub cmdTaskReport_Click()
On Error GoTo cmdTaskReport_Click_Err

    Select Case Me.Frame47.Value

     Case 1
         DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'"
     Case 2
         DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'"
     Case 3
         DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'"
     Case Else
         DoCmd.OpenForm "frmTasksContinuous", acNormal

     End Select

cmdTaskReport_Click_Exit:
    Exit Sub

cmdTaskReport_Click_Err:
    MsgBox Error$
    Resume cmdTaskReport_Click_Exit

End Sub


ET

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteveL13Author Commented:
etsherman... that worked.  But why?  What is the difference between you code y original code?

In other words what is the difference between:

DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'"

and

DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'", acFormEdit, acWindowNormal

Does the "acFormEdit" part of it allow for additions and edits?
Eric ShermanAccountant/DeveloperCommented:
Yes Sir ....

acFormEdit =  The user can edit existing records and add new records.


ET
Jeffrey CoachmanMIS LiasonCommented:
This is why I don't add in the optional arguments unless I know I need them...
Hamed NasrRetired IT ProfessionalCommented:
To allow access use the form settings in properties sheet, use datamode (acFormPropertySettings), which is the default mode, so it can be omitted from code. Modify your code as:

Select Case Me.Frame47.Value

     Case 1
         DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'", , acWindowNormal
     Case 2
         DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'", , acWindowNormal
     Case 3
         DoCmd.OpenForm "frmTasksContinuous", acNormal, , "[Priority]= '" & Me.txtPriority & "'", , acWindowNormal
     Case Else
         DoCmd.OpenForm "frmTasksContinuous", acNormal, , , , acWindowNormal
     End Select

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.