Hi
I am creating a command button at run time called "OK ".
I need to assign a procedure or a function whenever it is clicked .
It needs to have a message box " Data Saved ".
How do I assign that .
The Code I have written so far is as under
Thanks
Dim theControl as Control
Set theControl = frmAutoForm.Controls.Add("Forms.CommandButton.1", "cmdCancel", True)
With theControl
.Caption = "Cancel"
.Left = ctl_width + lbl_width - 100
.Width = 50
.Top = new_ctl_pos
End With
Set theControl = frmAutoForm.Controls.Add("Forms.CommandButton.1", "cmdOK", True)
With theControl
.Caption = "OK"
.Left = ctl_width + lbl_width + (2 * col_gutter) - 50
.Width = 50
.Top = new_ctl_pos
End With
I am creating a command button at run time called "OK ".
I need to assign a procedure or a function whenever it is clicked .
It needs to have a message box " Data Saved ".
How do I assign that .
The Code I have written so far is as under
Thanks
Dim theControl as Control
Set theControl = frmAutoForm.Controls.Add("Forms.CommandButton.1", "cmdCancel", True)
With theControl
.Caption = "Cancel"
.Left = ctl_width + lbl_width - 100
.Width = 50
.Top = new_ctl_pos
End With
Set theControl = frmAutoForm.Controls.Add("Forms.CommandButton.1", "cmdOK", True)
With theControl
.Caption = "OK"
.Left = ctl_width + lbl_width + (2 * col_gutter) - 50
.Width = 50
.Top = new_ctl_pos
End With