B
Brad Pears
I am attempting to write a very generic routine and can't quite seem to get
one part of it as "generic" as I'd like.
In the code I am referring to specific "forms" and "controls" which vary
obviously from screen to screen. I am trying to write the code "generically"
so that I
can call the same code from any screen.
Here is the line of code....
Here is a command I am currently executing from each form
' Turn the font green to show the current process
Forms![frmPricing]!frmMenuItems].Form.cmdGEFraming.ForeColor = 32768
How could I write a generic procedure that uses the mainform name, subform
name, and
appropriate command button name (as detailed above) that was passed to it
and then runs the code to actually set the color??
Please note that this is just one line that needs to be generalized. I have
many like this that I would like to have in one procedure and just
call it from each form that needs it...
The procedure would be something like this I would think...
' Call procedure to set the appropriate values
Call SetFormValues("MainFormName", "SubFormName", "ControlName",
"ForeColor", 32768)
Sub SetFormValues(strMain as string, strSub as string, strControl as string,
strProperty as string, PropertyValue as variant)
dim StrCommand as string
' Concatenate the string command
strCommand = "Forms![" & strMain & "]![" & strSub & "].form." & strControl &
"." & strProperty & "= " & PropertyValue
' I tried using "docmd.runcommand" (as show below) but it gives me a "Type
Mismatch"
docmd.runcommand(strCommand)
end sub
I also tried fiddling with the "command" object but did not get anywhere
there either...
Now that I have the command string concatenated (strCommand), how do I
actually run it in Access?
Any help would be most appreciated!
Thanks,
Brad
one part of it as "generic" as I'd like.
In the code I am referring to specific "forms" and "controls" which vary
obviously from screen to screen. I am trying to write the code "generically"
so that I
can call the same code from any screen.
Here is the line of code....
Here is a command I am currently executing from each form
' Turn the font green to show the current process
Forms![frmPricing]!frmMenuItems].Form.cmdGEFraming.ForeColor = 32768
How could I write a generic procedure that uses the mainform name, subform
name, and
appropriate command button name (as detailed above) that was passed to it
and then runs the code to actually set the color??
Please note that this is just one line that needs to be generalized. I have
many like this that I would like to have in one procedure and just
call it from each form that needs it...
The procedure would be something like this I would think...
' Call procedure to set the appropriate values
Call SetFormValues("MainFormName", "SubFormName", "ControlName",
"ForeColor", 32768)
Sub SetFormValues(strMain as string, strSub as string, strControl as string,
strProperty as string, PropertyValue as variant)
dim StrCommand as string
' Concatenate the string command
strCommand = "Forms![" & strMain & "]![" & strSub & "].form." & strControl &
"." & strProperty & "= " & PropertyValue
' I tried using "docmd.runcommand" (as show below) but it gives me a "Type
Mismatch"
docmd.runcommand(strCommand)
end sub
I also tried fiddling with the "command" object but did not get anywhere
there either...
Now that I have the command string concatenated (strCommand), how do I
actually run it in Access?
Any help would be most appreciated!
Thanks,
Brad