0
votes

I have a subform with unbound image controls that are being populated through code. I am using this subform to display search results when a SEARCH button is clicked. The problem is that I cannot refresh/requery the subform to reflect the current search status, except when I close and open again the form (subform) as a standalone/popup.

I tried this but failed to requery:

 With Me.F_Person_Thumbnails_control
 .SourceObject = Forms.F_Person_Thumbnails
 End With

I will appreciate any help.

Joseph

1

1 Answers

0
votes

Try accessing your unbound subform from the parent form.

' To Requery
me.mySubForm.form.requery

' To set a TextBox
me.mySubForm.form.controls("MyTextBox").value = "Test"

You can also access fields from your subform using the form.parent object, although I personally consider this a messier approach - since you are generating errors if the subform is opened by itself. Using the above approach lets you re-use the subform in other places in your database, with different logic (if required). Accessing parent object:

Me.MyTextBox.Value = Me.Parent.Form.Controls("IDNumber").Value