Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-25
13
Medium Priority
?
417 Views
Last Modified: 2012-06-27
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
Comment
Question by:Ei0914
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +1
13 Comments
 
LVL 75
ID: 35218352
"When I go into design view Allow Additions = false"
Sorry I'm confused. Then where do you see True ?

mx
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 35218439
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
 

Author Comment

by:Ei0914
ID: 35218476
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 668 total points
ID: 35218529
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
 
LVL 48

Assisted Solution

by:Dale Fye
Dale Fye earned 664 total points
ID: 35218540
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
 
LVL 48

Expert Comment

by:Dale Fye
ID: 35218550
I hate it when he does that!
0
 

Author Comment

by:Ei0914
ID: 35218602
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
 
LVL 75
ID: 35218760
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
 
LVL 16

Expert Comment

by:Sheils
ID: 35218844
<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
 

Author Comment

by:Ei0914
ID: 35219000
I didn't see a link to the website??
0
 
LVL 75
ID: 35219012
Stick with the Filter :-)

mx
0
 
LVL 16

Assisted Solution

by:Sheils
Sheils earned 668 total points
ID: 35219070
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
 

Author Closing Comment

by:Ei0914
ID: 35219354
Thanks, as always!
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question