Rooster1947
05-13-2009, 01:28 PM
I am using MS Access 2003 and have an ADO to query a record set building a "flat file" for EDI submission. I am trying to write an evaluating expression which will exclude two specific items. In other one or both are present in the recordset..ignore them write all others.
part of the code is:
If Not (.BOF = True And .EOF = True) Then
.MoveFirst
Do Until .EOF
If Left(.Fields.Item("CODE").Value, 4) = "9001" Then HOMEDELIVERY = "YES"
If Left(.Fields.Item("CODE").Value, 4) = "9001" Then DelChg = (.Fields.Item("BVORDQTY").Value * _
.Fields.Item("BVUNITPRICE").Value)
If Left(.Fields.Item("CODE").Value, 1) = "8" Then ScrapCredit = "PRESENT"
If Left(.Fields.Item("CODE").Value, 1) = "8" Then Scrap = (-(.Fields.Item("BVORDQTY").Value) * _
.Fields.Item("BVUNITPRICE").Value)
'ITEM
If Not (Left(.Fields.Item("CODE").Value, 1) = "8") Or (Left(.Fields.Item("CODE").Value, 4) = "9001") Then
myText = myText & "ITEM|"
myText = myText & i & "|"
myText = myText & .Fields.Item("BVORDQTY").Value & "|"
myText = myText & "EA|"
myText = myText & .Fields.Item("BVUNITPRICE").Value & "|"
myText = myText & "VN|"
myText = myText & Trim(.Fields.Item("CODE").Value) & "|SK|" & CUSTSKU & vbCrLf
'DESC
myText = myText & "DESC|"
myText = myText & Trim(.Fields.Item("SHD_DESCRIPTION").Value) & "|" & ScrapCredit & vbCrLf
End If
.MoveNext
i = i + 1
Loop
End If
The file works but will only recognize the evaluating statement before the "or" it does not recognize the statement after the "or".
Can't seem to read anything on this so trying this method to see if I can solve my problem
part of the code is:
If Not (.BOF = True And .EOF = True) Then
.MoveFirst
Do Until .EOF
If Left(.Fields.Item("CODE").Value, 4) = "9001" Then HOMEDELIVERY = "YES"
If Left(.Fields.Item("CODE").Value, 4) = "9001" Then DelChg = (.Fields.Item("BVORDQTY").Value * _
.Fields.Item("BVUNITPRICE").Value)
If Left(.Fields.Item("CODE").Value, 1) = "8" Then ScrapCredit = "PRESENT"
If Left(.Fields.Item("CODE").Value, 1) = "8" Then Scrap = (-(.Fields.Item("BVORDQTY").Value) * _
.Fields.Item("BVUNITPRICE").Value)
'ITEM
If Not (Left(.Fields.Item("CODE").Value, 1) = "8") Or (Left(.Fields.Item("CODE").Value, 4) = "9001") Then
myText = myText & "ITEM|"
myText = myText & i & "|"
myText = myText & .Fields.Item("BVORDQTY").Value & "|"
myText = myText & "EA|"
myText = myText & .Fields.Item("BVUNITPRICE").Value & "|"
myText = myText & "VN|"
myText = myText & Trim(.Fields.Item("CODE").Value) & "|SK|" & CUSTSKU & vbCrLf
'DESC
myText = myText & "DESC|"
myText = myText & Trim(.Fields.Item("SHD_DESCRIPTION").Value) & "|" & ScrapCredit & vbCrLf
End If
.MoveNext
i = i + 1
Loop
End If
The file works but will only recognize the evaluating statement before the "or" it does not recognize the statement after the "or".
Can't seem to read anything on this so trying this method to see if I can solve my problem