E
Eka1618
Hello,
I have a tab control with 8 pages. Each page has its own subform who's
record source is the same (tblTest). Before I click the send button, I am
trying to determine if the form was completed correctly. There are other
subforms within the parent form, buf for some reason, I cannot trigger the
point at which the insert into this particular table is occuring.
If the form is filled out correctly, and the last subform a user enters data
into reside inside the tab control, the following code does not work:
....
ElseIf IsNull(DLookup("[TEST_ID]", "tblTest", "[REQUEST_NO] = " &
REQUEST_NO.Value)) Then
MsgBox "You must enter at least one test for this request."
Else
....
(please disregard that it says ElseIf, I have other things going on)
It does not work because it still says that a test has never been entered
when in fact it did. Based on my observation the insert into tblTest is
definitely occuring after I click the send button. but I want to prevent the
form from sending a "request" if either A: the sub form was not completed and
B: If no test was inserted at all.
The button (btnSend) is located on the parent form. Here is the code for
this button:
Public Sub btnSend_Click()
Dim teesEmail As String
Dim torsEmail As String
Dim varItem As Variant
strValid = CheckFormValues(Me)
If strValid <> vbNullString Then
MsgBox "There are items on this form that were left blank. Please
review and fill in missing value."
ElseIf IsNull(DLookup("[L_ID]", "tblLock", "[REQUEST_NO] = " &
REQUEST_NO.Value)) Then
MsgBox "You must enter at least one Lock/Fastner."
ElseIf lockTest = True And IsNull(DLookup("[K_ID]", "tblKey",
"[REQUEST_NO] = " & REQUEST_NO.Value)) Then
MsgBox "You must enter a Key for this request."
ElseIf lugTool = True And IsNull(DLookup("[K_ID]", "tblKey",
"[REQUEST_NO] = " & REQUEST_NO.Value)) Then
MsgBox "You have chosen to include a tool with the Lug and did not
enter Tool information for this request."
ElseIf lockTest = True And IsNull(DLookup("[REQUEST_NO]", "tblPattern",
"[REQUEST_NO] = " & REQUEST_NO.Value)) Then
MsgBox "You must enter Pattern information for this request."
ElseIf IsNull(DLookup("[TEST_ID]", "tblTest", "[REQUEST_NO] = " &
REQUEST_NO.Value)) Then
MsgBox "You must enter at least one test for this request."
Else
For Each varItem In Me.lboRequestee.ItemsSelected
teesEmail = teesEmail & Me.lboRequestee.Column(2, varItem)
Next varItem
For Each varItem In Me.lboRequestor.ItemsSelected
torsEmail = torsEmail & lboRequestor.Column(2, varItem)
Next varItem
Call SetRequesteeEmailProp(teesEmail) ' found in modProperties
Call SetRequestorEmailProp(torsEmail) ' found in modProperties
Call SendRequest(Me)
DoCmd.Close acForm, "frmSingleRequest", acSaveNo
End If
End Sub
If anyone knows what I can do, please let me know. It is vital that this
issue is solved quickly. Thank You!
I have a tab control with 8 pages. Each page has its own subform who's
record source is the same (tblTest). Before I click the send button, I am
trying to determine if the form was completed correctly. There are other
subforms within the parent form, buf for some reason, I cannot trigger the
point at which the insert into this particular table is occuring.
If the form is filled out correctly, and the last subform a user enters data
into reside inside the tab control, the following code does not work:
....
ElseIf IsNull(DLookup("[TEST_ID]", "tblTest", "[REQUEST_NO] = " &
REQUEST_NO.Value)) Then
MsgBox "You must enter at least one test for this request."
Else
....
(please disregard that it says ElseIf, I have other things going on)
It does not work because it still says that a test has never been entered
when in fact it did. Based on my observation the insert into tblTest is
definitely occuring after I click the send button. but I want to prevent the
form from sending a "request" if either A: the sub form was not completed and
B: If no test was inserted at all.
The button (btnSend) is located on the parent form. Here is the code for
this button:
Public Sub btnSend_Click()
Dim teesEmail As String
Dim torsEmail As String
Dim varItem As Variant
strValid = CheckFormValues(Me)
If strValid <> vbNullString Then
MsgBox "There are items on this form that were left blank. Please
review and fill in missing value."
ElseIf IsNull(DLookup("[L_ID]", "tblLock", "[REQUEST_NO] = " &
REQUEST_NO.Value)) Then
MsgBox "You must enter at least one Lock/Fastner."
ElseIf lockTest = True And IsNull(DLookup("[K_ID]", "tblKey",
"[REQUEST_NO] = " & REQUEST_NO.Value)) Then
MsgBox "You must enter a Key for this request."
ElseIf lugTool = True And IsNull(DLookup("[K_ID]", "tblKey",
"[REQUEST_NO] = " & REQUEST_NO.Value)) Then
MsgBox "You have chosen to include a tool with the Lug and did not
enter Tool information for this request."
ElseIf lockTest = True And IsNull(DLookup("[REQUEST_NO]", "tblPattern",
"[REQUEST_NO] = " & REQUEST_NO.Value)) Then
MsgBox "You must enter Pattern information for this request."
ElseIf IsNull(DLookup("[TEST_ID]", "tblTest", "[REQUEST_NO] = " &
REQUEST_NO.Value)) Then
MsgBox "You must enter at least one test for this request."
Else
For Each varItem In Me.lboRequestee.ItemsSelected
teesEmail = teesEmail & Me.lboRequestee.Column(2, varItem)
Next varItem
For Each varItem In Me.lboRequestor.ItemsSelected
torsEmail = torsEmail & lboRequestor.Column(2, varItem)
Next varItem
Call SetRequesteeEmailProp(teesEmail) ' found in modProperties
Call SetRequestorEmailProp(torsEmail) ' found in modProperties
Call SendRequest(Me)
DoCmd.Close acForm, "frmSingleRequest", acSaveNo
End If
End Sub
If anyone knows what I can do, please let me know. It is vital that this
issue is solved quickly. Thank You!