Solved

Why datasheet view form behaving this way?

Posted on 2014-02-04
8
567 Views
Last Modified: 2014-02-06
I have a main form and a subform.  The subform opens in datasheet view.  The subform has a combobox the user can select records from.  As soon as the user clicks on the combobox a second record appears below the one they are entering data into so we end up with two records instead of one.  

The combobox's Row Source is a query.

??
0
Comment
Question by:SteveL13
  • 3
  • 3
  • 2
8 Comments
 

Expert Comment

by:marlind605
ID: 39834081
Check your subforms data property what what is it linked to?
0
 

Author Comment

by:SteveL13
ID: 39834090
Do you mean Link Master Fields and Link Child Fields?  If so they are both set to the right linking field.
0
 

Expert Comment

by:marlind605
ID: 39834093
Do you reference anything on the form from your query? You may need to set your subform default view to single form. But you want to make sure you get your correct data.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:SteveL13
ID: 39834106
There are unbound fields that populate from the selection in the combobox.
0
 

Expert Comment

by:marlind605
ID: 39834353
When I have a subform I reference a control on the query that is reference to the form like [Forms]![frmyourform]![yourcomboboxname] This will allow your subform to select the correct record. In this case I am selecting a startdate. The field in the query would be a date.
This link from Microsoft may explain it better.
http://office.microsoft.com/en-us/access-help/create-a-form-that-contains-a-subform-HA101872705.aspx
0
 
LVL 84
ID: 39835356
so we end up with two records instead of one.  
Does your subform actually save that record? It's not uncommon for Access to display the "new record row" when the subform receives the focus, but in general it won't save that record unless it's dirtied.
0
 

Author Comment

by:SteveL13
ID: 39835481
No, the subform does not actually save the record unless I started entering data into that "mystery" row.  I just think it's confusing to the user that it even appears and I really wish it wouldn't until I want it to appear.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39835572
That's default Access behavior, unfortunately, and you really can't stop it without altering the way Access works.

You can disallow new records on the Form - Set the form's AllowAdditions property to False, and then add a button where the user can enter new records. Since this is a subform, you can add the button on the mainform and use code like this:

Me.YourSubformCONTROL.Form.AllowAdditions = True

You could then use different events to toggle that back to False. For example, the LostFocus or Exit event of the Subform control, the AfterUpdate event of the subform, etc etc
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

770 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