Re: Refreshing a combo box based upon a database file w/o exiting

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Please disregard my last question. I did figure it out and get it to access
the Employee Master File from the Continuing Education Form.

Thanks so much for the help. It works great.

"Dirk Goldgar" wrote:

> "kirowan" <kirowan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:201DD155-EF1D-4640-8C6F-45E090A4CDA4@xxxxxxxxxxxxx
> > I created a combo box on a form based upon a query over the employee
> > master file, listing the employee number and employee name. The
> > employee number updates a field in the Continuing Education Detail
> > file.
> >
> > The problem I am having is when they are working on entering the
> > continuing education detail and come across a new employee. It
> > happens quite often. They open the employee master file form and
> > enter the new employee, but it does not come up in the combo box to
> > choose it in the continuing education detail form without closing out
> > of both the employee master file form (even though the record has
> > been saved to the employee master file) and continuing education
> > detail form and reopening the continuing education form.
>
> If the record has truly been saved on the Employee Master form, I doubt
> that you actually have to close that form. Of course, closing that form
> is a good way to ensure that the record has been saved, but there are
> lots of other ways. The problem is really with the Continuing Education
> Detail form, and finding a way to requery the combo box without closing
> the form.
>
> > Is there a way that the combo box can be refreshed each time it is
> > chosen on the field in the continuing education detail subform
> > without having to exit and reopen both forms?
> >
> > I have looked in my books and can not find the answer.
>
> This could make the combo box a bit slow to respond, if there are lots
> of employees. But if you want to do that, you could use code in the
> combo box's GotFocus event, along these lines:
>
> '----- start of example code -----
> Private Sub EmployeeNumber_GotFocus()
>
> Me!EmployeeNumber.Requery
>
> End Sub
> '----- end of example code -----
>
> Note that, if the focus has already entered the EmployeeNumber combo
> box, and then they open the Employee Master form, add the employee, and
> close that form so that the Continuing Education Detail form gets the
> focus again, then the GotFocus event won't fire again (and hence requery
> the combo box) unless the user moves to some other control on the form
> and then back again.
>
> What I usually do in cases like this is have code in the combo box's
> DblClick event that does the following:
>
> 1. Open the master form in dialog mode, so they can add the record. By
> opening it in dialog mode, I suspend execution of code in the combo
> box's event procedure until the master form is closed again.
>
> 2. The next line after the call to DoCmd.OpenForm (with the acDialog
> argument) requeries the combo box.
>
> So if they have to add a new employee, they double-click the combo box
> to open the employee master form. When that form is closed, the combo
> is then requeried.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>
.



Relevant Pages

  • Re: Code Clarity - Comments Invited
    ... matched data from the Employee Master File) into output which is then sent ... SSN input was the easier since the ... Employee Master has an SSN key; for Org input I would process the Master ...
    (comp.lang.cobol)
  • Re: Refreshing a combo box based upon a database file w/o exiting
    ... >> master file, listing the employee number and employee name. ... >> employee number updates a field in the Continuing Education Detail ... >> of both the employee master file form (even though the record has ...
    (microsoft.public.access.forms)
  • Refreshing a combo box based upon a database file w/o exiting the
    ... I created a combo box on a form based upon a query over the employee master ... updates a field in the Continuing Education Detail file. ... They open the employee master file form and enter the new employee, ...
    (microsoft.public.access.forms)
  • Re: New Job
    ... Other Pay: Generous Benefit Package ... Employee Type: Full-Time Employee ... Education - Teaching - Administration ... In my current (Division Manager) job, I didn't get told I was "hired" until ...
    (alt.2600)
  • Re: CNC Training - For Real! (I hope)
    ... F. George McDuffee wrote: ... implement the German trade education model. ... although large sums of money were expended. ... employee in other than very select technical and professional ...
    (alt.machines.cnc)