C
Cydney
Using the function as shown below, I'm trying to create a field in my query
that will give me the correct title for the rows of data. I'm calling it in
my query using: Expr1: SetInvBrkdwn(). When I run the query, the function
just loops around opening the recordset.
Can someone please help me put this function in proper syntax?
Function SetInvBrkdwn() As String
Dim MyExpT As String
Dim MyODC As String
Dim MyExpType As String
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("qCostBreakdowns")
With rs
MyExpT = .Fields("ExpT")
MyODC = .Fields("ODC")
MyExpType = .Fields("ExpType")
If MyExpType Like "*Fringe*" Then MyExpType = "Fringe"
If MyExpType Like "*Overhead*" Then MyExpType = "Overhead"
Select Case MyExpType
Case Is = "G&A" Or "Fixed Fee": .Fields("InvBrkDwn") = MyExpType
Case Is = "Fringe"
Select Case MyODC
Case Is = "LB": If MyExpT = "DL" Then .Fields("InvBrkDwn") =
"Headquarters Fringe Rate"
Case Is = "SC" Or "LB": If MyExpT = "FL" Then
..Fields("InvBrkDwn") = "Field / Contract Fringe Rate"
End Select
Case Is = "Overhead"
Select Case MyODC
Case Is = "LB": If MyExpT = "DL" Then .Fields("InvBrkDwn") =
"Headquarters Overhead Rate"
Case Is = "SC" Or "LB": If MyExpT = "FL" Then
..Fields("InvBrkDwn") = "Field / Contract Overhead Rate"
End Select
Case Is <> "Overhead", Is <> "Fringe"
Select Case MyODC
Case Is = "LB": If MyExpT = "DL" Then .Fields("InvBrkDwn") =
"Labor: Headquarters"
Case Is = "SC" Or "LB": If MyExpT = "FL" Then
..Fields("InvBrkDwn") = "Labor: Field / Contract"
End Select
Case Else
Exit Function
End Select
End With
rs.close
End Function
--
Thank you, cs
~~~~~~~~~~~~~~~~~~~~~~~~
"What lies behind us and what lies before us are tiny matters compared to
what lies within us."
~ Ralph Waldo Emerson
that will give me the correct title for the rows of data. I'm calling it in
my query using: Expr1: SetInvBrkdwn(). When I run the query, the function
just loops around opening the recordset.
Can someone please help me put this function in proper syntax?
Function SetInvBrkdwn() As String
Dim MyExpT As String
Dim MyODC As String
Dim MyExpType As String
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("qCostBreakdowns")
With rs
MyExpT = .Fields("ExpT")
MyODC = .Fields("ODC")
MyExpType = .Fields("ExpType")
If MyExpType Like "*Fringe*" Then MyExpType = "Fringe"
If MyExpType Like "*Overhead*" Then MyExpType = "Overhead"
Select Case MyExpType
Case Is = "G&A" Or "Fixed Fee": .Fields("InvBrkDwn") = MyExpType
Case Is = "Fringe"
Select Case MyODC
Case Is = "LB": If MyExpT = "DL" Then .Fields("InvBrkDwn") =
"Headquarters Fringe Rate"
Case Is = "SC" Or "LB": If MyExpT = "FL" Then
..Fields("InvBrkDwn") = "Field / Contract Fringe Rate"
End Select
Case Is = "Overhead"
Select Case MyODC
Case Is = "LB": If MyExpT = "DL" Then .Fields("InvBrkDwn") =
"Headquarters Overhead Rate"
Case Is = "SC" Or "LB": If MyExpT = "FL" Then
..Fields("InvBrkDwn") = "Field / Contract Overhead Rate"
End Select
Case Is <> "Overhead", Is <> "Fringe"
Select Case MyODC
Case Is = "LB": If MyExpT = "DL" Then .Fields("InvBrkDwn") =
"Labor: Headquarters"
Case Is = "SC" Or "LB": If MyExpT = "FL" Then
..Fields("InvBrkDwn") = "Labor: Field / Contract"
End Select
Case Else
Exit Function
End Select
End With
rs.close
End Function
--
Thank you, cs
~~~~~~~~~~~~~~~~~~~~~~~~
"What lies behind us and what lies before us are tiny matters compared to
what lies within us."
~ Ralph Waldo Emerson