Hi all,
I'm trying to programmatically create a form, add a command button, and assign an event procedure for the button. I'm running into a problem with adding the event procedure.
Here is the code I currently have:
VB Code:
Dim frmWarning As Form Dim btnOK As CommandButton Set frmWarning = CreateForm With frmWarning .Caption = "Warning" .AllowFormView = True .PopUp = True .ScrollBars = 0 'no scrollbars .RecordSelectors = False .NavigationButtons = False .DividingLines = False .Modal = True .Width = 4000 .GridX = 40 .GridY = 40 .Moveable = True .AutoCenter = True .CloseButton = False .ControlBox = False End With Set btnOK = CreateControl(frmWarning.Name, acCommandButton, acDetail, , , 1500, 2700, 950, 450) btnOK.Caption = "OK" btnOK.OnClick = "[Event Procedure]" 'Here is the problem DoCmd.OpenForm frmWarning.Name, acNormal DoCmd.Restore DoCmd.MoveSize 6000, 4000, 5500, 1800 'frmWarning.SetFocus 'frmWarning.Move 400, 400, 4000, 4000
I read in msdn that I should have "[Event Procedure]" as the OnClick property, but I can't figure out how to tell it which function to run.
Does anyone have any ideas on this?
Thanks,
Ranthalion




Reply With Quote