KerryMarie
MIS
I created a main form named frmCustomRpt.
I placed a tab control over this main form.
I created another form named frmSubTabular with its record source being a table named tblSecurity.
I then created subform named subTabular whose source object is frmSubTabular.
I placed the subTabular subform on one of the pages of the tab Control.
The subform has a Default View of Datasheet. The first field of this Datasheet view is called
KERBEROS. Once the user tabs off of a newly created record of this Datasheet, the following VBA code in the BeforeInsert Event and BeforeUpate Event of the FORM named frmSubTabular ensures that the user can't leave the record without entering a value for the 1st text box field named KERBEROS.
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim strLowCase As String
Dim strUpperCaseLN As String
Dim strUpperCaseFN As String
If IsNull(Me.KERBEROS) Then
Me.KERBEROS.SetFocus
Else
strLowCase = StrConv(Me.KERBEROS, vbLowerCase)
Me.KERBEROS = strLowCase
End If
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strLowCase As String
Dim strUpperCaseLN As String
Dim strUpperCaseFN As String
If IsNull(Me.KERBEROS) Then
Me.KERBEROS.SetFocus
Cancel = True
Else
strLowCase = StrConv(Me.KERBEROS, vbLowerCase)
Me.KERBEROS = strLowCase
End If
End Sub
Now I want to ensure that the user can't leave the newly created record without entering a text value for the 2nd field titled Last_Name and the 3rd field titled First_Name.
Does anyone know which event I could place the following VBA code in ?
Would the following snippets of code go into an event of the FORM or an event of the respective text box fields for Last_Name and First_Name ? Also which specific event should these snippets of code be placed in ?
If IsNull(Me.Last_Name) Then
Me.Last_Name.SetFocus
Else
strUpperCaseLN = StrConv(Me.Last_Name, vbUpperCase)
Me.Last_Name = strUpperCaseLN
End If
If IsNull(Me.First_Name) Then
Me.First_Name.SetFocus
Else
strUpperCaseFN = StrConv(Me.First_Name, vbUpperCase)
Me.First_Name = strUpperCaseFN
End If
I placed a tab control over this main form.
I created another form named frmSubTabular with its record source being a table named tblSecurity.
I then created subform named subTabular whose source object is frmSubTabular.
I placed the subTabular subform on one of the pages of the tab Control.
The subform has a Default View of Datasheet. The first field of this Datasheet view is called
KERBEROS. Once the user tabs off of a newly created record of this Datasheet, the following VBA code in the BeforeInsert Event and BeforeUpate Event of the FORM named frmSubTabular ensures that the user can't leave the record without entering a value for the 1st text box field named KERBEROS.
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim strLowCase As String
Dim strUpperCaseLN As String
Dim strUpperCaseFN As String
If IsNull(Me.KERBEROS) Then
Me.KERBEROS.SetFocus
Else
strLowCase = StrConv(Me.KERBEROS, vbLowerCase)
Me.KERBEROS = strLowCase
End If
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strLowCase As String
Dim strUpperCaseLN As String
Dim strUpperCaseFN As String
If IsNull(Me.KERBEROS) Then
Me.KERBEROS.SetFocus
Cancel = True
Else
strLowCase = StrConv(Me.KERBEROS, vbLowerCase)
Me.KERBEROS = strLowCase
End If
End Sub
Now I want to ensure that the user can't leave the newly created record without entering a text value for the 2nd field titled Last_Name and the 3rd field titled First_Name.
Does anyone know which event I could place the following VBA code in ?
Would the following snippets of code go into an event of the FORM or an event of the respective text box fields for Last_Name and First_Name ? Also which specific event should these snippets of code be placed in ?
If IsNull(Me.Last_Name) Then
Me.Last_Name.SetFocus
Else
strUpperCaseLN = StrConv(Me.Last_Name, vbUpperCase)
Me.Last_Name = strUpperCaseLN
End If
If IsNull(Me.First_Name) Then
Me.First_Name.SetFocus
Else
strUpperCaseFN = StrConv(Me.First_Name, vbUpperCase)
Me.First_Name = strUpperCaseFN
End If