GrandMasterTuck
In need of medication
- Local time
- Today, 18:40
- Joined
- May 4, 2013
- Messages
- 129
[SOLVED] Load a form/report dynamically with tempvars
Hey folks... is there a way to code a button that will load a form or report, but have the form or report's name saved in a TempVar?
For example, have a button on Form1 that loads either Form2 or Form3, depending on which form's name is saved to a TempVar. So if some other action saves the text "Form1" as TempVars!TheFormName, the button's code says Open the form called """ & TempVars!TheFormName & """ or whatever...
Am I making any sense? Here's the OpenForm VBA:
What I want to do is fetch that value in quotes there with the value of a TempVar. What's the syntax for this?
Hey folks... is there a way to code a button that will load a form or report, but have the form or report's name saved in a TempVar?
For example, have a button on Form1 that loads either Form2 or Form3, depending on which form's name is saved to a TempVar. So if some other action saves the text "Form1" as TempVars!TheFormName, the button's code says Open the form called """ & TempVars!TheFormName & """ or whatever...
Am I making any sense? Here's the OpenForm VBA:
Code:
Private Sub OpenForm_Click()
DoCmd.OpenForm "frmForm1"
End Sub
What I want to do is fetch that value in quotes there with the value of a TempVar. What's the syntax for this?
Code:
DoCmd.OpenForm """ & [TempVars]![TheFormName] & """
Last edited: