Solved

Why datasheet view form behaving this way?

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

Author Comment

by:SteveL13
ID: 39834106
There are unbound fields that populate from the selection in the combobox.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now