M
martinmike2
Hello,
My main form is spontaneously creating empty records in my main table
when the form loads. There is nothing in the OnLoad event and this is
eluding me. Any help would be great.
I have a snippet of code in the Current event of the form that counts
records in a subform and if there arn't any then produce a msg box to
display a custom error.
CODE:
Private Sub Form_Current()
'-------------------------------------------------------------------
If Me.Actual_SSNs_subform.Form.Recordset.RecordCount = 0 Then
Me.Actual_SSNs_subform.Visible = False
Else
Me.Actual_SSNs_subform.Visible = True
End If
' -------------------------------------------------------------------
' Store the AimdNum for later use
Dim H_PHONE As Variant
On Error Resume Next
gSSN = Me.frcnum.Value
' Store Member data for later user
On Error Resume Next
gAddress = Me.txtAddy.Value
gCity = Me.txtCity.Value
gState = Me.txtState.Value
gZIP = Me.txtZip.Value
If (H_PHONE = "") Then
gPhone = Me.txtC_PHONE.Value
Else
gPhone = Me.txtH_Phone.Value
End If
'----------------------------------------------------------------------
Dim loc As String
Dim pic As Integer
Dim strPic As String
Me.lblNOPIC.Visible = False
loc = "S:\JAXS\AIMD\SHARES\Manpower db\Pictures\"
pic = gSSN
If Dir(loc & pic & ".jpg") = vbNullString Then
Me.imgEmp.Visible = False
Me.lblNOPIC.Visible = True
Else
Me.imgEmp.PICTURE = loc & pic & ".jpg"
Me.imgEmp.Visible = True
End If
'-----------------------------------------------------------------------
If Me.frmPERSsub.Form.Recordset.RecordCount = 0 Then
Me.Refresh
If Me.frmPERSsub.Form.Recordset.RecordCount = 0 Then
MsgBox "Member has no EDVR Data. Refer Member to MANPOWER for
check-in.", vbCritical + vbOKOnly, gstrAppTitle
End If
End If
End Sub
the frmPERSsub is the last addition before the problem started.
Behind frmPERSsub is:
SELECT tblBRCL.BRANCH, EDVR.UIC, EDVR.SSN, EDVR.A_RATE_ABR
FROM EDVR INNER JOIN tblBRCL ON EDVR.BR_CL = tblBRCL.BR_CL;
frmPERS is the main form, behind that form is a query:
SELECT PERS.*
FROM PERS
ORDER BY PERS.[NAME LAST]
WITH OWNERACCESS OPTION;
Any help is appreciated immensely.
-Michael Martin
My main form is spontaneously creating empty records in my main table
when the form loads. There is nothing in the OnLoad event and this is
eluding me. Any help would be great.
I have a snippet of code in the Current event of the form that counts
records in a subform and if there arn't any then produce a msg box to
display a custom error.
CODE:
Private Sub Form_Current()
'-------------------------------------------------------------------
If Me.Actual_SSNs_subform.Form.Recordset.RecordCount = 0 Then
Me.Actual_SSNs_subform.Visible = False
Else
Me.Actual_SSNs_subform.Visible = True
End If
' -------------------------------------------------------------------
' Store the AimdNum for later use
Dim H_PHONE As Variant
On Error Resume Next
gSSN = Me.frcnum.Value
' Store Member data for later user
On Error Resume Next
gAddress = Me.txtAddy.Value
gCity = Me.txtCity.Value
gState = Me.txtState.Value
gZIP = Me.txtZip.Value
If (H_PHONE = "") Then
gPhone = Me.txtC_PHONE.Value
Else
gPhone = Me.txtH_Phone.Value
End If
'----------------------------------------------------------------------
Dim loc As String
Dim pic As Integer
Dim strPic As String
Me.lblNOPIC.Visible = False
loc = "S:\JAXS\AIMD\SHARES\Manpower db\Pictures\"
pic = gSSN
If Dir(loc & pic & ".jpg") = vbNullString Then
Me.imgEmp.Visible = False
Me.lblNOPIC.Visible = True
Else
Me.imgEmp.PICTURE = loc & pic & ".jpg"
Me.imgEmp.Visible = True
End If
'-----------------------------------------------------------------------
If Me.frmPERSsub.Form.Recordset.RecordCount = 0 Then
Me.Refresh
If Me.frmPERSsub.Form.Recordset.RecordCount = 0 Then
MsgBox "Member has no EDVR Data. Refer Member to MANPOWER for
check-in.", vbCritical + vbOKOnly, gstrAppTitle
End If
End If
End Sub
the frmPERSsub is the last addition before the problem started.
Behind frmPERSsub is:
SELECT tblBRCL.BRANCH, EDVR.UIC, EDVR.SSN, EDVR.A_RATE_ABR
FROM EDVR INNER JOIN tblBRCL ON EDVR.BR_CL = tblBRCL.BR_CL;
frmPERS is the main form, behind that form is a query:
SELECT PERS.*
FROM PERS
ORDER BY PERS.[NAME LAST]
WITH OWNERACCESS OPTION;
Any help is appreciated immensely.
-Michael Martin