Hi there
(Can DoCmd.openform allow formname from stored string value?)

I am needing to vary the FormName part of the .openform based on a result looked up in another table. as I have 10 Different forms that will be specific to a certain kind of record.

My code something like this:

Dim NewFrmName

NewFrmName = Dlookup ~~~looks up the form name from table
'so NewFrmName will end up NewFrmName = Frm_RepairParts or something

DoCmd.OpenForm NewFrmName, acNormal, "", "", acAdd, acNormal

End Sub.

Error I get is "the action or method required a form name argument"
so it does not like my NewFrmName variable and need another way of doing this.

anyone know a way to do what I am wanting ??
many thanks

7 Years
Discussion Span
Last Post by Access07-Jon

I'll answer my own question here !!!

I just figured it out. Dohh

Just need to put [ ] around the form variable. then its fine, open the correct form per lookup result !

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.