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!

Too much Fields? into MODULES

Status
Not open for further replies.

chsu

Programmer
Jan 19, 2000
17
US
Hi

I am trying to elimiate the multiple fields. REDUCE FROM MANY TO ONE! What I got:

AMEXXUSD1
AMEXXUSD1 - remove
AMEXXUSD2
AMEXXUSD2 - remove
AMEXXUSD4
AMEXXUSD4 - remove
AMEXXUSD5
AMEXXUSD5 - remove
AMEXXUSD7
AMEXXUSD7 - remove
AUSXXAUD1
AUSXXUSD1
AUSXXAUD2
AUSXXUSD2
AUSXXAUD4
AUSXXUSD4
AUSXXAUD5
AUSXXUSD5
AUSXXAUD7
AUSXXUSD7
FRAXXFRF1

I wrote the code via Modules. Here it is:
'WORLD - AMEUKEXXXXXP
Set rsStruc = dbStruc.OpenRecordset("AMEUKEXXPPP", dbOpenSnapshot)
rsStruc.MoveFirst
Do Until rsStruc.EOF
strBU = Right(rsStruc.Fields("BUSINESS_UNIT"), 3)
strBUDesc = rsStruc.Fields("Bu ShortDesc")
strCCC = rsStruc.Fields("CURCODE")
strP = rsStruc.Fields("PRACTICE")
strPDesc = rsStruc.Fields("DESCRIPTION")
'NAME - WORLD
strEnt = strBU & "XX" & strCCC & strP
strEnt2 = strBU & "XXUSD" & strP
strEntDesc = strBUDesc & " " & strPDesc
If strEnt1 <> strEnt And strP <> 0 Then Print #intName, strEnt & &quot;!&quot; & strEntDesc & &quot;!&quot; & strBU & strP & strNameEnd & strCCC & strNameEnd1
If strEnt1 <> strEnt And strP = 0 Then Print #intName, strEnt & &quot;!&quot; & strEntDesc & &quot;!&quot; & strBU & strP & 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 & strP & &quot; ! !USD !0! ! ! ! !CHART! ! ! !CHART&quot;
'OWNER - WORLD
If strEnt1 <> strEnt And strP <> 0 Then Print #intOwn, strBU & strLOC & &quot;!&quot; & strEnt & strOwnEnd
If strEnt <> strEnt2 And strP <> 0 Then Print #intOwn, strBU & strLOC & &quot;!&quot; & strEnt2 & strOwnEnd
strEnt1 = strEnt
strEnt3 = strEnt2
rsStruc.MoveNext
Loop
rsStruc.Close

Please advise. I kindly appreciate your help. :)

Regards,
CHsu [sig][/sig]
 
You might try reformatting your IfThen statements to IfThenElse statements. I had the same problem in Access 97 and fixed it by this method. I dont know why it worked, but it did. I think Access uses different IfThen methods depending where you write them (ie. queries,forms,reports).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top