N
Nicholas Scarpinato
I have a form I'm creating dynamically from code. The main reason for
creating it from code is that I have no use for it after the user selects the
option from a combobox on said created form, so I want to create it, get the
user input, and kill it. My question is, how do I make a command button on
said form run a function when the user clicks it? I can't seem to figure out
how. I've tried using the following code:
Set RunProc = CreateControl(frm.Name, acCommandButton, acDetail, , , 2880,
55, 1375, 265)
RunProc.Caption = "Select Vendor"
RunProc.FontName = "Arial"
RunProc.FontSize = 8
RunProc.OnClick = "[Event Procedure]"
But nothing happens when I click the button because it doesn't have code
linked to it, even though it says "[Event Procedure]" in the OnClick event.
Is there a way to code the OnClick event of a form inside of an Access module?
(At this point, I'm seriously considering scrapping this idea due to the
fact that loading this created form takes FOREVER once it's finished... it
takes up to 20 seconds to load, which is unacceptable. But I would still like
to know if this is possible, for future reference.)
creating it from code is that I have no use for it after the user selects the
option from a combobox on said created form, so I want to create it, get the
user input, and kill it. My question is, how do I make a command button on
said form run a function when the user clicks it? I can't seem to figure out
how. I've tried using the following code:
Set RunProc = CreateControl(frm.Name, acCommandButton, acDetail, , , 2880,
55, 1375, 265)
RunProc.Caption = "Select Vendor"
RunProc.FontName = "Arial"
RunProc.FontSize = 8
RunProc.OnClick = "[Event Procedure]"
But nothing happens when I click the button because it doesn't have code
linked to it, even though it says "[Event Procedure]" in the OnClick event.
Is there a way to code the OnClick event of a form inside of an Access module?
(At this point, I'm seriously considering scrapping this idea due to the
fact that loading this created form takes FOREVER once it's finished... it
takes up to 20 seconds to load, which is unacceptable. But I would still like
to know if this is possible, for future reference.)