?
Solved

Why datasheet view form behaving this way?

Posted on 2014-02-04
8
Medium Priority
?
582 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

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 85
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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

762 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