I have the following function:
'Retuns Plant for a given Sales Org and Order Type combination
Public Function getPlant(strSOrg As String, strOrderType As String, strGivenPlant As String) As String
Dim strCorrectPlant As String
If strOrderType = "ZJTD" Or strOrderType = "ZJTE" Or strOrderType = "ZJTF" Or strOrderType = "ZJTS" Or strOrderType = "ZJTW" Then
If strSOrg = "USSO" Then
strCorrectPlant = "0045"
Else
strCorrectPlant = "0005"
End If
Else
strCorrectPlant = strGivenPlant
End If
getPlant = strCorrectPlant
End Function
and below the first if line I want to add the following
IF (Material = Cascade Material) And (Dldate – Created On) < 90 Then “0042”
where "Material" and "Cascade Material' are headers in a 2 separate tables that will link and "Dldate" and "Created On" are date ranges in the same table.
I know that this is probably straight forward but I am not that familiar with writing VBA and I inherited this database.
Thanks
'Retuns Plant for a given Sales Org and Order Type combination
Public Function getPlant(strSOrg As String, strOrderType As String, strGivenPlant As String) As String
Dim strCorrectPlant As String
If strOrderType = "ZJTD" Or strOrderType = "ZJTE" Or strOrderType = "ZJTF" Or strOrderType = "ZJTS" Or strOrderType = "ZJTW" Then
If strSOrg = "USSO" Then
strCorrectPlant = "0045"
Else
strCorrectPlant = "0005"
End If
Else
strCorrectPlant = strGivenPlant
End If
getPlant = strCorrectPlant
End Function
and below the first if line I want to add the following
IF (Material = Cascade Material) And (Dldate – Created On) < 90 Then “0042”
where "Material" and "Cascade Material' are headers in a 2 separate tables that will link and "Dldate" and "Created On" are date ranges in the same table.
I know that this is probably straight forward but I am not that familiar with writing VBA and I inherited this database.
Thanks