Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate field

Status
Not open for further replies.

chsu

Programmer
Jan 19, 2000
17
US
Hi

I am struggled with the code like back and forth. Maybe I am tired or Friday of 13th? Anyway, I am trying to set up the field like below:

AME00USD101000!AME00000101000
AME10USD101000!AME00000101000
AME10USD101000!AME00000101000

AME10USD101000!AME10USD101000 - I don't want that. How to get rid of.


I wrote the code:

'WORLD - BULOCPPPSSS
Set rsStruc = dbStruc.OpenRecordset("REGBULOCPPPSSS", dbOpenSnapshot)
rsStruc.MoveFirst
Do Until rsStruc.EOF
strBU = Right(rsStruc.Fields("BUSINESS_UNIT"), 3)
strBUDesc = rsStruc.Fields("Bu ShortDesc")
strLOC = rsStruc.Fields("LOCAL_CTRY")
strLOCDesc = rsStruc.Fields("LOCAL_SHORTDESCR")
strCCC = rsStruc.Fields("CURCODE")
strP = rsStruc.Fields("PRACTICE")
strPDesc = rsStruc.Fields("DESCRIPTION")
strPPP = rsStruc.Fields("PPP")
strPPPDesc = rsStruc.Fields("PPPDESC")
strPPPSSS = rsStruc.Fields("PRODUCT")
strPPPSSSDesc = rsStruc.Fields("DESCRSHORT")
'NAME - WORLD
strEnt = strBU & strLOC & "000" & strPPPSSS
strEnt2 = strBU & strLOC & "USD" & strPPPSSS
strEntDesc = strLOCDesc & " " & strPPPSSSDesc
If strEnt <> strEnt1 And strP <> 0 Then Print #intName, strEnt & &quot;!&quot; & strEntDesc & &quot;!&quot; & strBU & strP & strNameEnd & strCCC & strNameEnd1
If strEnt <> strEnt1 And strP = 0 Then Print #intName, strEnt & &quot;!&quot; & strEntDesc & &quot;!&quot; & strBU & strNameEnd & strCCC & strNameEnd1
If strEnt3 <> strEnt2 And strP <> 0 Then Print #intName, strEnt2 & &quot;!&quot; & strEntDesc & &quot;!&quot; & strBU & strP & &quot; ! !USD !0! ! ! ! !CHART! ! ! !CHART&quot;
If strEnt3 <> strEnt2 And strP = 0 Then Print #intName, strEnt2 & &quot;!&quot; & strEntDesc & &quot;!&quot; & strBU & &quot; ! !USD !0! ! ! ! !CHART! ! ! !CHART&quot;
'OWNER - WORLD
If strEnt <> strEnt1 And strP = 0 Then Print #intOwn, strBU & strLOC & &quot;000&quot; & strPPP & &quot;XXX&quot; & &quot;!&quot; & strEnt & strOwnEnd
If strEnt <> strEnt1 And strP <> 0 Then Print #intOwn, strBU & strLOC & &quot;000&quot; & strPPP & &quot;XXX&quot; & &quot;!&quot; & strEnt & strOwnEnd
If strEnt3 <> strEnt2 And strP = 0 Then Print #intOwn, strBU & strLOC & &quot;USD&quot; & strPPP & &quot;XXX&quot; & &quot;!&quot; & strEnt2 & strOwnEnd
If strEnt3 <> strEnt2 And strP <> 0 Then Print #intOwn, strBU & strLOC & &quot;USD&quot; & strPPP & &quot;XXX&quot; & &quot;!&quot; & strEnt2 & strOwnEnd
If strEnt <> strEnt1 And strP = 0 Then Print #intOwn, strBU & strLOC & &quot;USD&quot; & strPPPSSS & &quot;!&quot; & strEnt & strOwnEnd
If strEnt <> strEnt1 And strP <> 0 Then Print #intOwn, strBU & strLOC & &quot;USD&quot; & strPPPSSS & &quot;!&quot; & strEnt & strOwnEnd
strEnt1 = strEnt
strEnt3 = strEnt2
strEnt2 = strEnt
rsStruc.MoveNext

Loop
rsStruc.Close

Am I missing? Please find something.

Thanks for all your help. :-0

chsu
[sig][/sig]
 
chsu,

After looking at your code quickly the only question that I have is did you try using a Do While Loop instead of Do Until.
If you change your loop to:
Do While Not rsStruc.EOF

You may get the results you want.
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top