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
Solved

Refresh only 1 field on an Access form

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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 …

860 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