Requery Combo list on subform with multiple parent forms

bgmiller

Registered User.
Local time
Today, 09:56
Joined
Jun 27, 2002
Messages
14
I have ComboList1 on Subform1 that is located in both Parent1 and Parent2 forms. The record information in ComboList1 can be edited by clicking a button on Subform1 that opens EditForm1. After changes are made, the record is saved and focus returns back to the ComboList1 on Subform1

I have alot of these "editable" comboboxes set up throught the database and I'd like an easy way to requery the combo lists on the subform after changes are made

I tried using the GotFocus of ComboList1 although I can't directly reference the ComboList1 because it may be opened through a different Parent form: Forms![??ParentForm??]!Subform1.ComboList1.Requery.

I'd like to have the code figure out what parent Subform1 is opened in and, even better, what subform the ComboList is in.


Thanks,

Brian
 
You wrote
<<
Forms![??ParentForm??]!Subform1.ComboList1.Requery
>>

I believe you can substitute:
Me.Parent!Subform1.ComboList1.Requery

as long as both main forms user "Subform1" as the name of the subform control.

RichM
 
Object not supported

Thanks for the reply Rich

The real names of the forms are as follows:

Subform1= "frmContactSelect"
ComboList1= "ContactList"

I made a command button in frmContactSelect to test it and assigned the following to the Onclick event:

Me.Parent!frmContactSelect.ContactList.Requery

It returned: Object doesn't support this property or method (Error 438)

Any suggestions?
 
Me.Parent!Subform1.ComboList1.Requery is wrong syntax.
Use Me.Parent!Subform1.Form!ComboList1.Requery
 
Me.Parent!frmContactSelect.ContactList.Requery is wrong syntax.
Use Me.Parent!frmContactSelect.Form!ContactList.Requery
 
Glen's example is correct. Mine was wrong. Oh the shame, the shame.

Anyway, I reread the original post and maybe understand the problem better. You have a subform that opens another form for editing. When the "edit" form closes, you want to requery something on the subform. Right ?

What you want to do is:
make a command button on the subform,
make an OnClick event sub,
in the event sub, open the edit form as a "dialog",
when the edit form closes, control returns to the OnClick sub,
then you can requery controls in the subform.

Since this code is in the subform, it won't matter what parent form is involved.

HTH,
RichM
 
What about Combo Dbl Click to Edit

I prefer to use OnDbl_Click on the subform's combolist to open the edit form.

What can I do then for launching the requry command when the edit form closes?

I've tried gotfocus on both the subform and combolist with no luck.

Thanks
 
I prefer to use OnDbl_Click on the subform's combolist to open the edit form.

What can I do then for launching the requry command when the edit form closes?

I've tried gotfocus on both the subform and combolist with no luck.
>>

OnDbl_Click is fine. Use whatever event you want.

In the event code, open the edit form in dialog mode. See Access Help for details. After the edit form closes, execution resumes in the event code. Then you requery.

RichM
 
Sorry Rich, I didn't mean to rub it in by posting twice. I actually meant to edit my post but I stuffed up somehow. :p
 

Users who are viewing this thread

Back
Top Bottom