Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 424
  • Last Modified:

Change in form's recordsource resets allow-additions to true

Every time I change a form's recordsource -- the form resets to Allow Additions = true

Why does this happen? When I go into design view Allow Additions = false
0
Eileen Murphy
Asked:
Eileen Murphy
  • 4
  • 4
  • 3
  • +1
3 Solutions
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"When I go into design view Allow Additions = false"
Sorry I'm confused. Then where do you see True ?

mx
0
 
Dale FyeCommented:
I've never encountered that.

Are you seeing this because you are displaying the navigation buttons?  What indication are you getting on the form that the AllowAdditions is true?

0
 
Eileen MurphyIndependent Application DeveloperAuthor Commented:
I have a frame  control with options for the user to choose the recordsource (a query against the same table with different criteria) -- and it works great, except that when they make a change, there is suddenly a new record line in the continuous form. In design view the Allow Additions setting is False. I don't have code making a change to it either.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
In general, from a performance standpoint, you would be better of not changing the Form Recordsource, instead resetting the Form Filter with your option buttons - against the same recordsource

Me.Filter = <SomeCriteria>
Me.Filter=True

However ... for the moment, try - in your option group adding:

Me.AllowAdditions = False

mx
0
 
Dale FyeCommented:
If it is the same query, why are you changing the recordsource?  Instead, just use the Filter property of the form.

Private Sub og_FilterCriteria_AfterUpdate()

    if me.og_FilterCriteria = 0 then
        me.Filter = ""
        me.FilterOn = False
    Elseif me.og_FilterCriteria = 1 then
        me.Filter = "[Field1] = 'Some value'"
        me.FilterOn = True
    Elseif me.og_FilterCriteria = 2 then
         me.Filter = "[Field1] Like '*SomeValue*'"
         me.FilterOn = true
    End if

End Sub
     
0
 
Dale FyeCommented:
I hate it when he does that!
0
 
Eileen MurphyIndependent Application DeveloperAuthor Commented:
I can use a filter ----  but some of the criteria was hairy -- so I thought it'd be easier this way instead of a bunch of ands and ors, etc....

I still don't see how it's happening though...

I hate when it does that too!
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Does seem odd.
But I would fly with the filter approach if possible.

Each time you change the Form's Recordsource, Access has to re-bind all the bound controls, as well as other overhead.   Filter is the elegant way.  But I know what you are saying about hairy criteria!

mx
0
 
SheilsCommented:
<I can use a filter ----  but some of the criteria was hairy -- so I thought it'd be easier this way instead of a bunch of ands and ors, etc....>

Sounds to me like a candidate for Query by Form(QBF). The following website have a good example of QBF. It is a bit hairy if you are new to vba and sql but w can guide you through.

0
 
Eileen MurphyIndependent Application DeveloperAuthor Commented:
I didn't see a link to the website??
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Stick with the Filter :-)

mx
0
 
SheilsCommented:
Opps! A little bit absent minded, still early in the morning. There it is:

http://www.fontstuff.com/access/acctut18.htm

Whether you use it or not should depend on the complexity of your query.
0
 
Eileen MurphyIndependent Application DeveloperAuthor Commented:
Thanks, as always!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 4
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now