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!

Remove the line

Status
Not open for further replies.

chsu

Programmer
Jan 19, 2000
17
US
Hi everyone!

I am trying to get rid of the line. For example: (what I need that)

AME00000101XXX - keep
AME00000102XXX - keep
AME00000199XXX - keep
AME00000201XXX - keep
AME00000202XXX - keep
AME00000203XXX - keep
AME10000101XXX - keep
AME10000102XXX - keep
...
...
...
AME30000101XXX - keep
AME30000102XXX - keep
AME30000199XXX - keep
AME30000202XXX - remove
AME30000204XXX - remove
AME30000205XXX - remove
...
...
UKE90000799XXX - keep
UKE90000999XXX - keep

I hope you can help me out for re-writing the code. Here I have the code:

'WORLD - BULOCPPP
Set rsStruc = dbStruc.OpenRecordset("REGBULOCPPP", 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")
'NAME - WORLD
strEnt = strBU & strLOC & "000" & strPPP & "XXX"
strEnt2 = strBU & strLOC & "USD" & strPPP & "XXX"
strEntDesc = strLOCDesc & " " & strPPPDesc
If strEnt1 <> strEnt And strPPP <> 0 Then Print #intName, strEnt & &quot;!&quot; & strEntDesc & &quot;!&quot; & strBU & strP & strNameEnd & strCCC & strNameEnd1
If strEnt3 <> strEnt2 And strPPP <> 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 > -1 Then Print #intOwn, strBU & strLOC & &quot;000&quot; & strP & &quot;!&quot; & strEnt & strOwnEnd
If strEnt3 <> strEnt2 And strP > -1 Then Print #intOwn, strBU & strLOC & &quot;USD&quot; & strP & &quot;!&quot; & strEnt2 & strOwnEnd
strEnt1 = strEnt
strEnt3 = strEnt2
rsStruc.MoveNext
Loop
rsStruc.Close

Let me know. Thank you for your help.

Regards,
Candice
happy.gif
 
You didn't state whether your list is associated with a certain field or variable name. Why not just search for 'remove' and use the .delete method of the recordset. This would be a straight forward means of eliminating records.

If InStr(1, strVar, &quot;remove&quot;) Then
rsStruc.Edit
rsStruct!Delete
rsStruct.Update
End If

Steve King Growth follows a healthy professional curiosity
 
Hi Steve

I was trying to do your code. It doesn't work. I am working on using ACCESS 2000. (I am also trying to learn how to do the code. I am not expert for that so I would like to learn more.) Ok you are right about eliminating records.

Ok I already created the tables, queries, marcos and modules. I has been put all of the records in TABLES as &quot;VALID ENTITIES.&quot; I was trying to eliminate the records (what i wrote the previous message.) via modules.

If not working, I am trying to find something else to do.

Thanks,
Candice
 
Why not make an update query that removes the things you need and then call it from code? Or if you don't want to save an update query, write the query, go into SQL View, copy the SQL and use the RunSQL Method to do the deletion for you? You could use a right command to pull the correct data to delete like so:

IIf(right([MyField],6)=&quot;remove&quot;,left([MyField],len([MyField])-6),[MyField])

HTH Joe Miller
joe.miller@flotech.net
 
Candice,

Some items in the code are implied. I used strVar as a string variable representing whatever would contain the 'AME30000202XXX - remove' text. I also went by memory using a DAO recordset from Access 97. Try putting a Debug.Print line in the code to print out the values in the immediate window or place a breakpoint by selecting the line and using F9.

Steve Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top