A
Ayo
I would like to write a code that performs the following action:
1. If the value in a comboBox Project Number is 19912
2. Perform a select query on comboBox Task Number and comboBox National Site
ID
3. If the value in a comboBox Project Number is not 19912
4. Perform a select query on comboBox Task Number and a DLookup () on
comboBox National Site ID
I tried the code below but it's not working. Any ideas on how to do this?
If Me.cmbProjectNumber.Value="19912" then
cmbNationalSiteID.RowSource = "SELECT DISTINCT [National Site ID] FROM
[InScope Table] WHERE [Project Number]='" & Me.cmbProjectNumber.Value
& "'" & " ORDER BY [National Site ID]"
cmbNationalSiteID = Null
cmbNationalSiteID.Requery
Else
cmbNationalSiteID=Nz(DLookup("[National Site ID],"[Inscope
Table]","[Project
Number]='" & Forms![InscopeSiteSummary]!cmbProjectNumber & "'" & " And
[Task Number]='" & Forms![InscopeSiteSummary]!cmbTaskNumber & "'"),"")
End If
Any help will be greatly appreciated.
Thanks.
1. If the value in a comboBox Project Number is 19912
2. Perform a select query on comboBox Task Number and comboBox National Site
ID
3. If the value in a comboBox Project Number is not 19912
4. Perform a select query on comboBox Task Number and a DLookup () on
comboBox National Site ID
I tried the code below but it's not working. Any ideas on how to do this?
If Me.cmbProjectNumber.Value="19912" then
cmbNationalSiteID.RowSource = "SELECT DISTINCT [National Site ID] FROM
[InScope Table] WHERE [Project Number]='" & Me.cmbProjectNumber.Value
& "'" & " ORDER BY [National Site ID]"
cmbNationalSiteID = Null
cmbNationalSiteID.Requery
Else
cmbNationalSiteID=Nz(DLookup("[National Site ID],"[Inscope
Table]","[Project
Number]='" & Forms![InscopeSiteSummary]!cmbProjectNumber & "'" & " And
[Task Number]='" & Forms![InscopeSiteSummary]!cmbTaskNumber & "'"),"")
End If
Any help will be greatly appreciated.
Thanks.