I have a problem with setting the recordsource for a subform at runtime. I want to be to alternate between two queries with the same columns at runtime. At design time I have the recordsource set to the default query. But when I change the query at runtime - I get no records returned - even when I set the recordsource to itself.
For example:
'I can see records at this point
a = Me.frmUtilPrice.Form.RecordSource
'I can see records at this point
Me.frmUtilPrice.Form.RecordSource = a
'There are no records returned.
I traced this down to a known problem in access - that microsoft curiously returns the linkchildfields and linkmasterfields to the default - which is too specific for my case. But I cannot change them back - because when I try to change linkchildfields (for example) then it gives me an error like "linkchildfields and linkmasterfiels must have the same number of fields".
Is there a workaround to this or can I set both properties in one statement to avoid this error?
Any help would be appreciated
Jon
For example:
'I can see records at this point
a = Me.frmUtilPrice.Form.RecordSource
'I can see records at this point
Me.frmUtilPrice.Form.RecordSource = a
'There are no records returned.
I traced this down to a known problem in access - that microsoft curiously returns the linkchildfields and linkmasterfields to the default - which is too specific for my case. But I cannot change them back - because when I try to change linkchildfields (for example) then it gives me an error like "linkchildfields and linkmasterfiels must have the same number of fields".
Is there a workaround to this or can I set both properties in one statement to avoid this error?
Any help would be appreciated
Jon