What's my malfunction? change recordsource

MCantu

Registered User.
Local time
Today, 08:49
Joined
Nov 18, 2004
Messages
62
I have a form that, depending upon a combo box in the header, will change the recordsource of the form to whatever table is listed in the drop down.
I have no problem with that.
Unfortunately, my form has a continuous subform that shows all entries on that table for easy viewing.

I can change the recordsource for my main form- but I can't get the subform recordsource to change.

Here is what I have tried:

'Me!actsubform.Form!RecordSource = "A_" & [Unviewedlist]

Access says :Microsoft Access can’t find the field “actsubform” referred to in your expression

'Forms!actsubform.RecordSource = "A_" & [Unviewedlist]

'Forms("actsubform").RecordSource = "A_" & [Unviewedlist]

'[Forms]![Actsubform]!RecordSource = "A_" & [Unviewedlist]

Access says: Microsoft access can’t find the form ‘Actsubform’ referred to in a macro expression or virtual basic code


I think I must on the right track for the last three, because at least it doesn't call it a 'field' but calls it a "Form"

[Unviewedlist] is the combo box on the main form with the name of the table.
For instance, the combobox says "Jane_C"
The table is really called "A_Jane_C" so I added "A_".



Please tell me it's something obvious about the syntax.

Thank you for all of your help
 
nope.

I tried :


Me!Actsubform.Form.RecordSource = "A_" & [Unviewedlist]

Access referred to actsubform as a "Field" again.


It is possible that the information from the combo [Unviewedlist] is not being "Remembered" because I am referring to the subform?

I am trying to take what is on[Unviewedlist] from a combo on the main form, and use that information when I refer to the subform... but it 'forgets" when I refer to the subform... do you think that could be it?
 
bubble gum and string

well- I could not find the syntax I wanted so that when I picked from the drop down, it would change the subform, so I but this on the oncurrent of the subform :


Me.RecordSource = "A_" & Forms![Activity Authorization].[Unviewedlist]


It worked this way.

It sits there for a few seconds before it displays the information- doing something... but I got it to work.

If anyone knows a more elegant way- let me know.

Thanks for everyones help.
 
If the combo is on the MainForm and the SubForm is on this then under AfterUpdate Event in the MainForm:

Code:
Forms![<MainFormName>].[<SubFormName>].Form.RecordSource = "A_" & [Unviewedlist]
Me.<SubFormName>.Requery
 
Last edited:

Users who are viewing this thread

Back
Top Bottom