Solved

fresh only combo boxes on forms that are stayed open?

Posted on 2012-03-16
4
221 Views
Last Modified: 2012-03-19
Hi,

I have a acess 2007 database and several forms/subforms with combo boxes.
As example, I have three forms called publication, author and institution.
My users usually open all three forms to do the data entry.

The publication has a combo of authorlist.
When I don't see the author name, I go to the author form and create a new record.
After adding a new author, I ask users to click the refresh all button so the author combo box on the publication will requery it.

This refresh all makes all the opened forms to requery and lose the location of currently working location of the record.

What would be a fix for this kind of situation?
basically when I enter a new cord, I want only requery any controls that uses that table.
So I don't have to use refresh all button.

Do I look for specific combo boxes that use the table to which a newly added record went from _AfterUpdate()?
0
Comment
Question by:dkim18
  • 2
4 Comments
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 500 total points
ID: 37730650
Yes, just requery the combo boxes that need it, using syntax like this from the AfterUpdate event:

Forms![frmCustomers]![cboCity].Requery

Open in new window

0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 37730656
You might also need to check whether the form is open (though maybe not, if the users keep all the forms open all the time).  Here is some generic code for that:

   Dim prj As Object

   Set prj = Application.CurrentProject
    
   If prj.AllForms("fmnuMain").IsLoaded = True Then
      Forms![fmnuMain].Visible = True
   Else
      DoCmd.OpenForm "fmnuMain"
   End If

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37730665
Modified.
0
 

Author Comment

by:dkim18
ID: 37730682
The most combo boxes are in the subforms. It is bound to the subform. The control source is from the subform and row source is coming from a query.

Can't find the combo box control from the subform.


===================
Why am I checking if forms are open or not?
So I don't requery those control not opened?
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

747 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

12 Experts available now in Live!

Get 1:1 Help Now