TomJamieson
Registered User.
- Local time
- Today, 00:39
- Joined
- Jun 8, 2006
- Messages
- 50
Hi,
I've searched through previous dlookup threads, but nothing seems to work. I have the following code:
If IsNull(DLookup("[Type of QC 2]", "Priorities", [ID] = tempID)) And IsNull(DLookup("[Type of QC 3]", "Priorities", [ID] = tempID)) Then
Forms.frmQCReport.txtQCID = 1
End If
If Not IsNull(DLookup("[Type of QC 2]", "Priorities", [ID] = tempID)) And IsNull(DLookup("[Type of QC 3]", "Priorities", [ID] = tempID)) Then
Forms.frmQCReport.txtQCID = 2
End If
If Not IsNull(DLookup("[Type of QC 2]", "Priorities", [ID] = tempID)) And Not IsNull(DLookup("[Type of QC 3]", "Priorities", [ID] = tempID)) Then
Forms.frmQCReport.txtQCID = 3
End If
What it's doing is checking through the 3 fields in the "Priorities" table. According to how many of those are filled in, it populates the txtQCID field in the frmQCReport form with the appropriate number. If just the first field is entered (Type of QC 1) then the QCID is 1, if the first and second are filled, it is 2, and if all 3 are filled, it is 3.
I can't see what is wrong with my code, but it populates the txtQCID field with 2 every time.
Can anyone help?
I've searched through previous dlookup threads, but nothing seems to work. I have the following code:
If IsNull(DLookup("[Type of QC 2]", "Priorities", [ID] = tempID)) And IsNull(DLookup("[Type of QC 3]", "Priorities", [ID] = tempID)) Then
Forms.frmQCReport.txtQCID = 1
End If
If Not IsNull(DLookup("[Type of QC 2]", "Priorities", [ID] = tempID)) And IsNull(DLookup("[Type of QC 3]", "Priorities", [ID] = tempID)) Then
Forms.frmQCReport.txtQCID = 2
End If
If Not IsNull(DLookup("[Type of QC 2]", "Priorities", [ID] = tempID)) And Not IsNull(DLookup("[Type of QC 3]", "Priorities", [ID] = tempID)) Then
Forms.frmQCReport.txtQCID = 3
End If
What it's doing is checking through the 3 fields in the "Priorities" table. According to how many of those are filled in, it populates the txtQCID field in the frmQCReport form with the appropriate number. If just the first field is entered (Type of QC 1) then the QCID is 1, if the first and second are filled, it is 2, and if all 3 are filled, it is 3.
I can't see what is wrong with my code, but it populates the txtQCID field with 2 every time.
Can anyone help?