?
Solved

fresh only combo boxes on forms that are stayed open?

Posted on 2012-03-16
4
Medium Priority
?
233 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
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 Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

807 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