For the purpose of explaining the problematic situation I am only including those fields that are relevant to this particular query.
I have the following main table with the fields shown below:
tblOngoingHist:
OHID (int-primary key)
StaffID (int)
Time (int)
TopicDate(date/time)
AuditDate(date/time)
The field 'Time' holds an integer value that references another table(tblLookUpTime) that stores both the integer value and its corresponding string in terms of hours and minutes...
So tbkLookUpTime holds the following values:
TimeInt(Int - Primary Key) TimeStr(String)
15 15mins
30 30mins
60 1 hour
75 1hr 15mins
90 1hr 30mins
etc..(in 15 minute intervals upto 4hrs(integer value 240)
The query i am building should display the following fields:
tblOngoingHist.StaffId(matches specified criteria, i.e. a combobox on a form)
tblOngoingHist.TopicDate
tblOngoingHist.AuditDate
tblLookUpTime.TimeStr (INNER JOIN tblOngoingHist ON tblLookUpTime.TimeInt = tblOngoingHist.Time)
this works fine if all fields have a value in them, however there will be cases where just an audit date will be entered without a value for tblOngoingHist.Time.
When this is the case the following query doesn't work as expected:
SELECT tblOngoingHist.TopicDate, tblLookUpTime.TimeStr, tblOngoingHist.Auditdate
FROM tblLookUpTime INNER JOIN tblOngoingHist ON tblLookUpTime.TimeInt = tblOngoingHist.Time
WHERE (((tblOngoingHist.StaffID)=[Forms]![frmTrainSwitch]![subTrain].[Form]![cmbemp]));
It doesn't show results for those records that do not have a value in tblOngoingHist.Time.
Could anyone suggest a workaround for this situation, i know there is both the Nz and IIf functions but i can't seem to make them work for this situation where all records should be shown irrelevant of which feilds have values or not.
I have the following main table with the fields shown below:
tblOngoingHist:
OHID (int-primary key)
StaffID (int)
Time (int)
TopicDate(date/time)
AuditDate(date/time)
The field 'Time' holds an integer value that references another table(tblLookUpTime) that stores both the integer value and its corresponding string in terms of hours and minutes...
So tbkLookUpTime holds the following values:
TimeInt(Int - Primary Key) TimeStr(String)
15 15mins
30 30mins
60 1 hour
75 1hr 15mins
90 1hr 30mins
etc..(in 15 minute intervals upto 4hrs(integer value 240)
The query i am building should display the following fields:
tblOngoingHist.StaffId(matches specified criteria, i.e. a combobox on a form)
tblOngoingHist.TopicDate
tblOngoingHist.AuditDate
tblLookUpTime.TimeStr (INNER JOIN tblOngoingHist ON tblLookUpTime.TimeInt = tblOngoingHist.Time)
this works fine if all fields have a value in them, however there will be cases where just an audit date will be entered without a value for tblOngoingHist.Time.
When this is the case the following query doesn't work as expected:
SELECT tblOngoingHist.TopicDate, tblLookUpTime.TimeStr, tblOngoingHist.Auditdate
FROM tblLookUpTime INNER JOIN tblOngoingHist ON tblLookUpTime.TimeInt = tblOngoingHist.Time
WHERE (((tblOngoingHist.StaffID)=[Forms]![frmTrainSwitch]![subTrain].[Form]![cmbemp]));
It doesn't show results for those records that do not have a value in tblOngoingHist.Time.
Could anyone suggest a workaround for this situation, i know there is both the Nz and IIf functions but i can't seem to make them work for this situation where all records should be shown irrelevant of which feilds have values or not.