Solved

Refresh only 1 field on an Access form

Posted on 2014-07-22
5
1,215 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

863 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

28 Experts available now in Live!

Get 1:1 Help Now