| 
 Description: We want the users to
 notice there is something missing in
 textboxes before changing forms or
 updating records, the following code in
 the update-command button serves the
 checking: 
 Code:  
 Option
 Explicit  
 '  
 Private Sub cmdUpdate_Click()  
 Dim ctr As Control  
 '  
 '====================================  
 ' CHECKING EMPTY TEXTBOX SUBROUTINE  
 '====================================  
 '  
 'looping through the entire control
 collection  
 'in current form. "Controls" is
 a Collection  
 'of all controls on form  
 For Each ctr In Me.Controls  
 'use "TypeOf" function to
 identify TextBoxes  
 If TypeOf ctr Is TextBox Then  
 'check if the TextBox control has no Text
  
 If ctr.Text = vbNullString Then 
 MsgBox "TextBox information
 missing"  
 ctr.SetFocus  
 'Setfocus back to TextBox  
 Exit Sub  
 'This is to get out  
 End If  
 End If  
 Next ctr  
 '  
 '====================================  
 'Here you need to enter what you should
 do  
 'for thus buttons (e.g., Update, Exit,
 New form etc.)  
 'in case all TextBoxes have text.  
 '====================================  
 ' End Sub 
 Tip submitted by David
 Da-Teh Huang 
   |