Solved

Refresh only 1 field on an Access form

Posted on 2014-07-22
5
1,114 Views
Last Modified: 2014-07-28
I have run into a strange problem with the form I am working with.

The form does the following:

The user chooses an item from a combo box. Then a list of the items assigned to the first combo box item appears in a list box. At the bottom of the form is a place to add new items to the combo box item.

Every time I choose an item in the combo box, an additional blank record is being added to the combo box item. So, in the list box there are blank records.

I am thinking this is because I have the "Refresh Record" attached to the "After Update" event for the combo box. I wanted the list box to update every time an different choice in combo box is made.

It looks like it might be adding the values from the bottom of the form, which are empty when I first choose the item in the combo box, when the refresh record action is taken.

I am not sure what to do about this. I don't see a way to only refresh one field on a form. I am assuming there must be a way, but all I am finding are ways to refresh the whole form.
I have also tried putting the refresh option on the list box in the "Before Update" event. Nothing happened.




Any ideas?
0
Comment
Question by:Megin
5 Comments
 

Author Comment

by:Megin
ID: 40212879
Okay, I have a copy of my database I am attaching. The form is frm_SubTaskOrders.
NewStartPMAC.accdb
0
 
LVL 84
ID: 40213800
I don't understand the issue. If I open your database and open frm_SubTaskOrders, I can select a value from the combo and the related records appear in the "Existing Subtask Orders" listing. I don't see where new records are added, or anything of that nature.

So could you please restate the question?

Also, please Compact your database before uploading it here.
0
 
LVL 15

Accepted Solution

by:
JimFive earned 500 total points
ID: 40214025
You can requery just the list box by using ME.listbox.requery in the AfterUpdate event of the combo box.  What is happening is that you are using a bound combo box and when you refresh the form it is saving the new record.
0
 
LVL 26

Expert Comment

by:Nick67
ID: 40214525
@Megin
"Refresh Record" is used by Access to look and see if another user/process has changed the record you are presently using.  Generally, using DAO technologies--which you are--RefreshRecord is a useless call.  If another user has edited the record, you generally won't be able to successfully save your own edits anyway -- or no one has changed the records and so the call was useless.  Very rarely will you ever need to refresh records.

Requery is frequently used.  That command tells a control to go back to its data source and reload its data.  When you have cascading controls--which you do--in the AfterUpdate event of the 'parent' control, you tell the child control to requery, so that the change to the parameter gets reflected.
0
 

Author Closing Comment

by:Megin
ID: 40224520
Thank you! That was just the solution I needed. It worked great!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

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 originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

746 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

13 Experts available now in Live!

Get 1:1 Help Now