Solved

Refresh only 1 field on an Access form

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

724 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