Event property on a datasheet veiw form

BBryan

Registered User.
Local time
Today, 13:30
Joined
May 28, 2010
Messages
23
Hi
I have a Subform within a form both in datasheet view. I want to put a code behind it when I click on the Hiearcy + button to close. It seems that the form in data sht view is not closed or unloaded or deactivated but just hidden in this datasheet view or something and my code will not run. What Event property would I use for this?


Thanks Bryyan
 
I think you need to explain your question better.
 
Hi
Maybe I didn't explain this very good.
What I am trying to do is in a subform in Datasheet view upon going back to the main form is checking if I had missed filling in a text box. If any fields are missing Go back to the first Missed field. If there is no missed feilds do nothing.
I have this code. When I click on the + button (DataSheet veiw) to close My code doesn't run.

Private Sub Form_Close()
Dim Str As String
Dim Flag As Integer
Str = ""

If IsNull(WeldNo) Then
Str = "WeldNo"
Flag1 = 1
End If
If IsNull(Size) Then
Str = Str & ", Size"
Flag2 = 2
End If
If IsNull(WeldType) Then
Str = Str & ", WeldType"
Flag3 = 3

End If
If IsNull(Material) Then
Str = Str & ", Material"
Flag4 = 4

End If
If IsNull(MaterialService) Then
Str = Str & ", MaterialService"
Flag5 = 5

If IsNull(System) Then
Str = Str & ", System"
Flag6 = 6

End If

If Not IsNull(Flag1) or Not IsNull(Flag2) or Not IsNull(Flag3) or Not IsNull(Flag4) or Not IsNull(Flag5) or Not IsNull(Flag6) Then
If MsgBox("You Have not filled in these Textboxes" & vbCrLf & Str, vbOKCancel, "Missed TextBox Fields") = vbCancel Then
Cancel = True

End If
'set focus on first control
If Flag1 = 1 Then
[WeldNo].SetFocus
ElseIf Flag2 = 2 Then
Size.SetFocus
ElseIf Flag3 = 3 Then
WeldType.SetFocus
ElseIf Flag4 = 4 Then
Material.SetFocus
ElseIf Flag5 = 5 Then
MaterialService.SetFocus
Else
System.SetFocus
End If


End Sub

Thanks

 

Users who are viewing this thread

Back
Top Bottom