graviz
Registered User.
- Local time
- Today, 04:05
- Joined
- Aug 4, 2009
- Messages
- 167
I'm trying to improve my coding and have created a function to loop through an array of values to see if a particular field contains them. Right now I have them hard coded as seen below. I'd like the array to read from a table if possible. I created a table called "REF_IHS_Projects" and the column is called "ID" that contains the values below.
I've googled using the ADODB recordset function but can't figure out how to modify my code above. Thanks in advance!
Code:
Function IHS_Project_Levels(Project As String) As Integer
Dim CodeArray, i As Integer
CodeArray = Array("sh.p.smart home", "sh.p.supply chain", "sh.p.wfm / ofs", "sh.x.perficient", "sh.x.wfm/ofs", "sh.x.crafted", "sh.x.d2c.interstellar", "sh.x.dbdevelopment", "sh.x.kryptonite", "sh.x.perficient", "sh.x.transformers")
For i = 0 To UBound(CodeArray)
If InStr(Project, CodeArray(i)) Then
IHS_Project_Levels = 1
Exit Function
End If
Next
IHS_Project_Levels = 0
End Function
I've googled using the ADODB recordset function but can't figure out how to modify my code above. Thanks in advance!