Pop up Form to requery Two other forms

Muna

New member
Local time
Today, 18:23
Joined
Feb 4, 2014
Messages
6
Greeting,

I new to this form and to access and hope to find an answer to my problem.

I have 3 tables and 3 forms

Table 1 - Form 1 --- Psych Patients
Table 2 - Form 2 --- Med patients.
Table 3 - Form 3 --- Primary Doctors.

Each form has a combo box with a list of Primary Doctors. If doctor is not in the list then we have the option to enter new information via Pop up form (form 3). At close the Pop up form requerys the cbo box.

Is there a way to use Form 3 (pop-up form) to re-query both forms at the same time even if only one of the forms is open?

FYI, Table 1 and Table 2 contain different information and the only thing both table have in common is the primary doctors.

As of now my code in the pop Up is:

Private Sub Form3_Close ()
Form_Form1!cboPhy.Requery
End Sub

Is the only alternative to create another form for the physicians and use it for Form 2?

Thank you,
 
Of course, Requerying a closed form is an oxymoron. You can check if it is open by testing the IsLoaded Property of the form in the CurrentProject.AllForms Collection and only Requery if it is True.

BTW In my opinion you are heading into what you will eventually find is a development cul de sac by separating the Psych and Med patients into different tables.

Ask about ways of getting around the differences in the types of data recorded if you want to deal with it before continuing.
 
I can't make any changes unfortunately. The tables were created years ago and I was only asked to add the physician table and form.
CurrentProject.All Forms solve the problem.

Thanks,
 
I think that

Private Sub Form3_Close ()
On Error Resume Next
Form_Form1!cboPhy.Requery
Form_Form2!cboName.Requery
End Sub


should work too.
 
I prefer stop errors before they happen rather than ignore them unless there really is no way around it.

I can only recall ever having no option but to use Resume Next in one situation.
 

Users who are viewing this thread

Back
Top Bottom