Solved

Why datasheet view form behaving this way?

Posted on 2014-02-04
8
569 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
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

830 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