Solved

Why datasheet view form behaving this way?

Posted on 2014-02-04
8
575 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
[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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

734 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