Solved

fresh only combo boxes on forms that are stayed open?

Posted on 2012-03-16
4
223 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.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

776 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