jwcolby
jwcolby at colbyconsulting.com
Thu Feb 12 08:19:35 CST 2009
The following is the text for a form to import into the demo database. Save this into a file called
frmDemoSinkingCommandButtonEvent.txt in a path you can work with. Then do the following modifying
the path as needed:
ImportForm "frmDemoCtls",
"c:\Users\jwcolby\Documents\ClassesAndEventsDemo\frmDemoSinkingCommandButtonEvent.txt"
That will import the form into your demo database. My next email will demonstrate the use of this form.
Version =19
VersionRequired =19
Checksum =570145595
Begin Form
AllowDesignChanges = NotDefault
DefaultView =0
RecordLocks =2
TabularFamily =0
PictureAlignment =2
DatasheetGridlinesBehavior =3
GridX =24
GridY =24
DatasheetFontHeight =10
ItemSuffix =2
Left =270
Top =600
Right =9255
Bottom =5520
DatasheetGridlinesColor =12632256
RecSrcDt = Begin
0xadbae61e0c76e340
End
GUID = Begin
0xce4b8bda887c504e8a23fedefb80807a
End
NameMap = Begin
0x0acc0e5500000000000000000000000000000000000000000c00000003000000 ,
0x0000000000000000000000000000
End
DatasheetFontName ="Arial"
OnLoad ="[Event Procedure]"
Begin
Begin Label
BackStyle =0
FontName ="Tahoma"
End
Begin CommandButton
FontSize =8
FontWeight =400
ForeColor =-2147483630
FontName ="Tahoma"
End
Begin FormHeader
Height =360
BackColor =-2147483633
Name ="FormHeader"
GUID = Begin
0xb5abe32a309f324d8f00067aa83acb32
End
Begin
Begin Label
OverlapFlags =85
Left =600
Top =60
Width =2715
Height =210
Name ="Label1"
Caption ="Demo sinking command button event"
GUID = Begin
0x1533eb00bf216746812aaf771531439e
End
End
End
End
Begin Section
Height =660
BackColor =-2147483633
Name ="Detail"
GUID = Begin
0xb187e3478b2ea14da76df919daf58bae
End
End
Begin FormFooter
Height =696
BackColor =-2147483633
Name ="FormFooter"
GUID = Begin
0x6b8f07fee023894fb43f4a9eab240c0b
End
Begin
Begin CommandButton
OverlapFlags =85
Left =60
Top =60
Width =576
Height =576
Name ="cmdClose"
Caption ="Command0"
OnClick ="[Event Procedure]"
PictureData = Begin
0x2800000010000000100000000100040000000000800000000000000000000000 ,
0x0000000000000000000000000000800000800000008080008000000080008000 ,
0x8080000080808000c0c0c0000000ff00c0c0c00000ffff00ff000000c0c0c000 ,
0xffff0000ffffff00dadad0dadadadadaadad00adadadadaddad030dadadadada ,
0xad0330adadadadad0033300000000adaa03330ff0dadadadd03300ff0adad4da ,
0xa03330ff0dad44add03330ff0ad44444a03330ff0d444444d03330ff0ad44444 ,
0xa0330fff0dad44add030ffff0adad4daa00fffff0dadadadd00000000adadada ,
0xadadadadadadadad000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000000000000000000000000000000000000000000000000000 ,
0x0000000000000000
End
ObjectPalette = Begin
0x0003100000000000800000000080000080800000000080008000800000808000 ,
0x80808000c0c0c000ff000000c0c0c000ffff00000000ff00c0c0c00000ffff00 ,
0xffffff0000000000
End
ControlTipText ="Close Form"
GUID = Begin
0xdbd2723a0eb9004a9798854b2ec099fa
End
End
End
End
End
End
CodeBehindForm
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Compare Database
Option Explicit
Dim WithEvents cmd As CommandButton
Private Sub cmd_Click()
MsgBox Me.Name & ": " & cmd.Name & ": Click event"
End Sub
Private Sub Form_Load()
On Error Resume Next
Set cmd = Forms!frmDemoCtls!Command15
MsgBox cmd.Name
End Sub
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
DoCmd.Close
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click
End Sub