N
NeoFax
I have a form with 2 subforms. The main form is used to delimit the
1st subform and then the 1st subform on change updates the 2nd
subform. If there is no discrepancy in the second subform and the
technician wants to input one, he/she types in the info and then
selects the next record in the 1st subform. My problem is that the
below code does not work using the OnExit event of the 2nd subform.
Here is my code:
Private Sub subfrmIssues3_Exit(Cancel As Integer)
Dim tmpHelo As Double
Dim tmpStation As String
Dim tmpJCNum As String
tmpHelo = Forms.frmIssues.subfrmIssues2.Form.txtHelo
tmpStation = Forms.frmIssues.subfrmIssues2.Form.txtStation
tmpJCNum = Forms.frmIssues.subfrmIssues2.Form.txtJCNum
MsgBox ("Helo=" & tmpHelo & " and Sta=" & tmpStation & " and JC=" &
tmpJCNum)
strWhere = "[HELO#]=""" & tmpHelo & " and [STAGE#]=""" & tmpStation &
" and [JobCard#]=" & tmpJCNum & """"
If IsNothing(DLookup("[HELO#]", "tblIssues", strWhere)) Then
Set dbs = CurrentDb
dbs.Execute "INSERT INTO tblIssues ([HELO#],[STAGE#],[JobCard#],
[Discrepancy]) " & _
"VALUES (" & tmpHelo & ", '" & tmpStation & "', '" & tmpJCNum & "',
'" & Forms.frmIssues.subfrmIssues3.Form.txtDisc & "')"
End If
End Sub
Any help would be appreciated.
1st subform and then the 1st subform on change updates the 2nd
subform. If there is no discrepancy in the second subform and the
technician wants to input one, he/she types in the info and then
selects the next record in the 1st subform. My problem is that the
below code does not work using the OnExit event of the 2nd subform.
Here is my code:
Private Sub subfrmIssues3_Exit(Cancel As Integer)
Dim tmpHelo As Double
Dim tmpStation As String
Dim tmpJCNum As String
tmpHelo = Forms.frmIssues.subfrmIssues2.Form.txtHelo
tmpStation = Forms.frmIssues.subfrmIssues2.Form.txtStation
tmpJCNum = Forms.frmIssues.subfrmIssues2.Form.txtJCNum
MsgBox ("Helo=" & tmpHelo & " and Sta=" & tmpStation & " and JC=" &
tmpJCNum)
strWhere = "[HELO#]=""" & tmpHelo & " and [STAGE#]=""" & tmpStation &
" and [JobCard#]=" & tmpJCNum & """"
If IsNothing(DLookup("[HELO#]", "tblIssues", strWhere)) Then
Set dbs = CurrentDb
dbs.Execute "INSERT INTO tblIssues ([HELO#],[STAGE#],[JobCard#],
[Discrepancy]) " & _
"VALUES (" & tmpHelo & ", '" & tmpStation & "', '" & tmpJCNum & "',
'" & Forms.frmIssues.subfrmIssues3.Form.txtDisc & "')"
End If
End Sub
Any help would be appreciated.