Table Not Refreshing

  • Thread starter Thread starter George Pryhuber
  • Start date Start date
G

George Pryhuber

I have table for job titles and via a form allows
additions and deletions.
When an addition or deletion is made they do not show up
on another forms drop down box which uses the table.
I've tried "fieldname.refresh" etc. and nothing seems to
work until I exit and reopen the db.

What do you suggest?

Thanking you in advance for your help.

George
 
One of the first things I do, when I see something pretty whacky, is to do a
Compact/Repair on the database. (Note: Make a backup of the database -- Just
In Case!)

Is the controls on the form bound to a table/query?

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
George Pryhuber said:
I have table for job titles and via a form allows
additions and deletions.
When an addition or deletion is made they do not show up
on another forms drop down box which uses the table.
I've tried "fieldname.refresh" etc. and nothing seems to
work until I exit and reopen the db.

What do you suggest?

Thanking you in advance for your help.

George

You need to requery, not refresh, the control that has that table as its
rowsource, using a statement like

Me!MyControlName.Requery

or

Forms!MyFormName!MyControlName.Requery

The only question is when to execute the statement, and that depends on
the curcumstances in which you add to the table. Do you open the Job
Titles form from the form containing the combo box based on job titles?
If so, you can open the Job Titles form in dialog mode, and add the
requery statement immediately following the line that opens the form:


DoCmd.OpenForm "frmJobTitles", WindowMode:=acDialog
Me.MyControlName.Requery

If not, you probably have to check in the Close or AfterUpdate event of
the Job Titles form to see if the other form is open, and if so, requery
the control on that form:

Private Sub Form_Close()

If CurrentProject.AllForms("MyFormName").IsLoaded Then
Forms!MyFormName!MyControlName.Requery
End If

End Sub
 
Back
Top