JGalletta
Windows 7 Access 2010
- Local time
- Yesterday, 22:02
- Joined
- Feb 9, 2012
- Messages
- 149
I have an interesting issue where one of my subform's Current event is executing twice. Here is the event:
Can anyone identify what might be making this event execute twice?
Code:
Private Sub Form_Current()
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE tblFieldListPopulation.[Field Number] FROM tblFieldListPopulation"
DoCmd.RunSQL "INSERT INTO tblFieldListPopulation ( [Field Number] ) SELECT tblFieldInformation.[Field Number] FROM tblFieldInformation"
DoCmd.RunSQL "DELETE tblFieldListDeletion.[Field Number] FROM tblFieldListDeletion"
DoCmd.RunSQL "INSERT INTO tblFieldListDeletion ( [Field Number] ) SELECT tblFieldRecJoin.[Field Number] FROM tblFieldRecJoin WHERE (((tblFieldRecJoin.[Record Number])=[Forms]![frmScoutingRecords]![Record Number]))"
If CurrentDb.TableDefs("tblFieldListDeletion").RecordCount > 0 Then
Dim MySQL As String
MySQL = "DELETE tblFieldListPopulation.[Field Number] FROM tblFieldListPopulation Where tblFieldListPopulation.[Field Number] IN ("
Dim r As DAO.Recordset
Set r = CurrentDb.OpenRecordset("Select * From tblFieldListDeletion")
r.MoveFirst
Do Until r.EOF = True
MySQL = MySQL & "'" & r![Field Number] & "', "
r.MoveNext
Loop
r.Close
Set r = Nothing
MySQL = Left(MySQL, (Len(MySQL) - 2)) & ")"
DoCmd.RunSQL MySQL
End If
DoCmd.SetWarnings True
Me.FieldNo.Requery
If IsNull(Me.FieldNo) Then
'MsgBox ("frmFieldRecJoin_Current Field is Null")
Me.Text79 = Me.JoinPK
Forms!frmScoutingRecords!Text58.ControlSource = "=' Pest List'"
Forms!frmScoutingRecords!Child49.SourceObject = "frmBlankPestDetail2"
Forms!frmScoutingRecords!Child60.SourceObject = "frmBlankPestDetail"
Else
'MsgBox ("frmFieldRecJoin_Current Field is NOT Null")
Me.Text79 = Me.JoinPK
Forms!frmScoutingRecords!Child49.SourceObject = "frmFieldRecInfo"
Forms!frmScoutingRecords!SRJoinPK = Me.JoinPK
Forms!frmScoutingRecords!Text58.ControlSource = "=' Showing Pests for Field ' & DLookup('[Field Number]', '[tblFieldRecJoin]', '[JoinPK] = ' & [Forms]![frmScoutingRecords]!SRJoinPK) & '.'"
Forms!frmScoutingRecords!Child49.Form.Filter = "[JoinPK] = " & Forms!frmScoutingRecords!SRJoinPK
Forms!frmScoutingRecords!Child49.Form.Requery
End If
End Sub
Can anyone identify what might be making this event execute twice?