L
Little Penny
I have a Left Join query to find all the record in the tbl_LogJobData
that do not have link records in the tbl_Check. Tables tbl_LogJobData
and tbl_Check are linked by a primary and foreign (one to Many). How
can I change my query to show me one the records in the tbl_LogJobData
that have only one linked record in the tbl_Check table.
Thanks
Little Penny
My Code
Dim strSQL As String
Dim strWhere As String
Const conJetDate = "\#mm\/dd\/yyyy\#" 'The format expected for dates
in a JET query string.
DoCmd.OpenForm "frmSearchSignBy", , , , , acDialog
If IsLoaded("frmSearchSignBy") Then
strWhere = strWhere & "([tbl_Check.OpLogJobDataID] is Null) AND "
strWhere = strWhere & "([tbl_LogJobData.InsertDate] >= " &
Format([Forms]![frmSearchSignBy]![CboBeginningDate], conJetDate) & ")
AND "
strWhere = strWhere & "([tbl_LogJobData.InsertDate] <= " &
Format([Forms]![frmSearchSignBy]![CboEndingDate], conJetDate) & ") "
strSQL = "SELECT tbl_LogJobData.* FROM tbl_LogJobData " & _
"LEFT JOIN tbl_Check ON " & _
"tbl_LogJobData.OpLogJobDataID = tbl_Check.OpLogJobDataID " &
_
"WHERE " & strWhere
Form_frm_JobDataViewSQL.RecordSource = strSQL
MsgBox "Results have been filtered."
End If
DoCmd.Close acForm, "frmSearchSignBy"
End Sub
that do not have link records in the tbl_Check. Tables tbl_LogJobData
and tbl_Check are linked by a primary and foreign (one to Many). How
can I change my query to show me one the records in the tbl_LogJobData
that have only one linked record in the tbl_Check table.
Thanks
Little Penny
My Code
Dim strSQL As String
Dim strWhere As String
Const conJetDate = "\#mm\/dd\/yyyy\#" 'The format expected for dates
in a JET query string.
DoCmd.OpenForm "frmSearchSignBy", , , , , acDialog
If IsLoaded("frmSearchSignBy") Then
strWhere = strWhere & "([tbl_Check.OpLogJobDataID] is Null) AND "
strWhere = strWhere & "([tbl_LogJobData.InsertDate] >= " &
Format([Forms]![frmSearchSignBy]![CboBeginningDate], conJetDate) & ")
AND "
strWhere = strWhere & "([tbl_LogJobData.InsertDate] <= " &
Format([Forms]![frmSearchSignBy]![CboEndingDate], conJetDate) & ") "
strSQL = "SELECT tbl_LogJobData.* FROM tbl_LogJobData " & _
"LEFT JOIN tbl_Check ON " & _
"tbl_LogJobData.OpLogJobDataID = tbl_Check.OpLogJobDataID " &
_
"WHERE " & strWhere
Form_frm_JobDataViewSQL.RecordSource = strSQL
MsgBox "Results have been filtered."
End If
DoCmd.Close acForm, "frmSearchSignBy"
End Sub