Unanswered: Passing parameters to a form prior to opening
I want to create a dynamic help screen for my users.
They double click on a lable, which in turn would open a form with the control's name and a description of the information that it should contain.
The form that would be driving this 'help' form has about 10 controls on it and I don't want to create 10 forms. i want to create one form and pass it the control name the the help context so the form knows how to populate itself.
My initial thoughts were to store this data as a global variable accessible by both forms and on the load event for the subsequent form it would do a quick dlookup and load two label controls with the informaiton.
But it seems that I should be able to pass some type of parameter to a form via the "docmd.openform" function.
You could steal my "DebugStr()" function that I plant in every database. It's basically a form with a textbox on it that I populate AFTER the form opens using a little script.
So we have a function called DebugStr (could just as easily be "OpenHelp" or what have you) that takes a string argument for display, opens the form and pushes the argument into a textbox:
Public Sub OpenHelp(strIn As String)
Dim frm As Form
Set frm = forms!yourHelpDisplayForm 'You have to open the form before setting an object to it, annoying.
.lblYourHelpLabel.Caption = strIn
.txtSomeOtherUsefulInfo = DLookup("whatever", "someHelpTable", "criteria = 'goes here'")
The idea is to use the function as an accessor method to the forms controls. If you want to get tricky like me, you can modify it to check if the form is open, accept parameters for whether it's supposed to append or replace the information currently in the textbox etc...