If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Calling Event Procedure from a Form Variable
Hello,
I would like to call an event procedure from a form variable. Can it be done? I tried this, and got a message: Runtime error '2465': Application-Defined or Object-Defined error. DoCmd.OpenForm "Order Entry Header Admin", , , "[OrdID] =" & [ordID] Dim frm As Form Set frm = Forms("Order Entry Header Admin") Call frm.Copy_Record_Click Set frm = Nothing Can this be done or is my method just wrong. Thank you for your help and God Bless, Mark A. Sam |
#2
|
|||
|
|||
Calling Event Procedure from a Form Variable
"Mark A. Sam" wrote in message
... Hello, I would like to call an event procedure from a form variable. Can it be done? I tried this, and got a message: Runtime error '2465': Application-Defined or Object-Defined error. DoCmd.OpenForm "Order Entry Header Admin", , , "[OrdID] =" & [ordID] Dim frm As Form Set frm = Forms("Order Entry Header Admin") Call frm.Copy_Record_Click Set frm = Nothing Can this be done or is my method just wrong. You can do it, but the procedure you call must be Public, not Private. Since event procedures are Private by default (e.g., "Private Sub Copy_Record_Click()"), you must modify the event procedure's code to make it Public: Public Sub Copy_Record_Click() -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
#3
|
|||
|
|||
Calling Event Procedure from a Form Variable
Thank you Dirk.
"Dirk Goldgar" wrote in message ... "Mark A. Sam" wrote in message ... Hello, I would like to call an event procedure from a form variable. Can it be done? I tried this, and got a message: Runtime error '2465': Application-Defined or Object-Defined error. DoCmd.OpenForm "Order Entry Header Admin", , , "[OrdID] =" & [ordID] Dim frm As Form Set frm = Forms("Order Entry Header Admin") Call frm.Copy_Record_Click Set frm = Nothing Can this be done or is my method just wrong. You can do it, but the procedure you call must be Public, not Private. Since event procedures are Private by default (e.g., "Private Sub Copy_Record_Click()"), you must modify the event procedure's code to make it Public: Public Sub Copy_Record_Click() -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|