0
votes

I'm having an issue with MS Access 2010 which drives me crazy. I do have a form with some subforms. The subforms are not linked to the main form, but their recordsource queries on some fields on the mainform. So far so good. If I change the values of the fields on the mainform the subforms are showing the correct records.

However when I reset the values on the mainform with some VBA code the issue begins.

Let's say one of my subforms has the following sourceobject:

Me.[Subformulier].SourceObject = "Form A"

When I reset the mainform I use below code:

Me.[Subformulier].SourceObject = ""

..
execute some code

..

Me.[Subformulier].SourceObject = "Form A"

However my Subform isn't returning any records. The funny thing is however when I open the subform it is showing exactly the records I was looking for...

Can anyone help me with this?

1
Have you tried the Requery or Refresh method on the subform? - Scott Holtzman
Yep, tried them both. I even tried to recalc, refresh and requery the mainform including the subforms - HB1963
Why are you doing this: Me.[Subformulier].SourceObject = Me.[Subformulier].SourceObject = ""` - dbmitch
I'm not. Actually what I'm doing is first set the sourceobject of the subform to none (""), so remove the subform source and close it, then execute some code which can only be executed if the subform is not open anyhow and after that set the sourceobject of the subform back to "Form A" - HB1963

1 Answers

0
votes

OK, looks like I've found the answer on "http://www.access-programmers.co.uk/forums/showthread.php?t=55410". It appeared that my mainform was bound to a query were it shouldn't have been. Removing this bounded query did the trick. Thought I knew MS Access a bit, but appearantly there is still much to learn