Double clicking either of the two reports in this database causes the database to look up the name of the report in a table and get a list of the criteria that the report uses, the text for the criteria label, location on the criteria pop up form, etc. and opens the form. When the button is clicked it reads through the list again and looks for the corresponding textbox, read it and calls a function to place the value into a global variable. Up until the time it calls the function to place the value, the name of the criteria is not hard coded. It is referred to as a variable. However, as you can see in the function Set_Report_Parms in the module, here I am using a Case statement that codes the name of each global variable. I would like to refer directly to the variable just as I did in the form with the textbox names, however, I haven't been able to figure out how to do it with variables in a module.
For example, this code works for controling various text boxes on a form without actually coding the name of any textbox
With Me.Controls(ctltxt)
.Top = topini
.Left = 2020
.TabStop = True
.TabIndex = rs!TbOrder
.Width = rs!CtrlWidth
.Visible = True
End With
I believe this would also work with
With Forms.Formname.Controls(ctltxt)
I would like to, somehow, refer to global variables with something like
With Modules.ModuleName.Variables(varnm). I have not been able to figure out how to refer to a public variable declared in a module.
For example, this code works for controling various text boxes on a form without actually coding the name of any textbox
With Me.Controls(ctltxt)
.Top = topini
.Left = 2020
.TabStop = True
.TabIndex = rs!TbOrder
.Width = rs!CtrlWidth
.Visible = True
End With
I believe this would also work with
With Forms.Formname.Controls(ctltxt)
I would like to, somehow, refer to global variables with something like
With Modules.ModuleName.Variables(varnm). I have not been able to figure out how to refer to a public variable declared in a module.
Attachments
Last edited: