Delete or Hide all records in a table that begin with a 1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The table has one field and a various amount of records. I need the info in
the table to export to my output.txt.

If I Hide the fields I'm guessing it exports them anyway so I probably need
a delete statement.

The records begin with a mixed number for instance 1003DFRE or 2DF234F Any
combination of letters or numbers can be found except the first character is
either and always a 1 or a 2.

Note: I need to make the action in the table not the export statement.

I need to remove the records that begin with a 1 so when I export the
contents of the table I only see the records beginning with a 2 in my output
file.
 
You don't really Hide, you filter. Create a select query based on your
table. For example purposes, we will call the field in you table
[ONE_BIG_FIELD]

In the Criteria row of your query, enter this:
Left([ONE_BIG_FIELD], 1) = "2"

Now only those records where ONE_BIG_FIELD begins with a 2 will be exported.
Nothing will change in your table.

Now use the query name in your TransferText instead of the file name.
 
You mentioned "Now use the query name in your TransferText instead of the
file name."

Doesn't that counter what I stated? "Note: I need to make the action in the
table not the export statement."

The tables are temp tables. I don't care about their integrity after I run
these changes. I need the changes done.

I guess this did answer the first part of my question...

I need a delete statement for all records that begin with the num 1. BUT
NOTE! the 1 is a part of a code EX: 1D00456 or 1009GHS

Klatuu said:
You don't really Hide, you filter. Create a select query based on your
table. For example purposes, we will call the field in you table
[ONE_BIG_FIELD]

In the Criteria row of your query, enter this:
Left([ONE_BIG_FIELD], 1) = "2"

Now only those records where ONE_BIG_FIELD begins with a 2 will be exported.
Nothing will change in your table.

Now use the query name in your TransferText instead of the file name.

julialatte said:
The table has one field and a various amount of records. I need the info in
the table to export to my output.txt.

If I Hide the fields I'm guessing it exports them anyway so I probably need
a delete statement.

The records begin with a mixed number for instance 1003DFRE or 2DF234F Any
combination of letters or numbers can be found except the first character is
either and always a 1 or a 2.

Note: I need to make the action in the table not the export statement.

I need to remove the records that begin with a 1 so when I export the
contents of the table I only see the records beginning with a 2 in my output
file.
 
No, it does not counter what you said.
First, an action does not occur within a table. An action occurs as the
results of executing a query. The action does not take place in the
transfer, it take place prior to the transfer, so whether you do the action
then run the transfer, or run the tranfer using a query that does the action
is really the same thing. The query does the work. You did not say they are
temp tables and that deleting the entries that don't start with 2 was what
you wanted. You did say Delete or Hide; however, I answered with the least
destructive approach.

But, if you want to delete them, just run this line of code:

CurrentDb.Execute("DELETE * FROM SomeTable WHERE Left([ONE_BIG_FIELD], 1) <>
"2";"), dbFailOnError

julialatte said:
You mentioned "Now use the query name in your TransferText instead of the
file name."

Doesn't that counter what I stated? "Note: I need to make the action in the
table not the export statement."

The tables are temp tables. I don't care about their integrity after I run
these changes. I need the changes done.

I guess this did answer the first part of my question...

I need a delete statement for all records that begin with the num 1. BUT
NOTE! the 1 is a part of a code EX: 1D00456 or 1009GHS

Klatuu said:
You don't really Hide, you filter. Create a select query based on your
table. For example purposes, we will call the field in you table
[ONE_BIG_FIELD]

In the Criteria row of your query, enter this:
Left([ONE_BIG_FIELD], 1) = "2"

Now only those records where ONE_BIG_FIELD begins with a 2 will be exported.
Nothing will change in your table.

Now use the query name in your TransferText instead of the file name.

julialatte said:
The table has one field and a various amount of records. I need the info in
the table to export to my output.txt.

If I Hide the fields I'm guessing it exports them anyway so I probably need
a delete statement.

The records begin with a mixed number for instance 1003DFRE or 2DF234F Any
combination of letters or numbers can be found except the first character is
either and always a 1 or a 2.

Note: I need to make the action in the table not the export statement.

I need to remove the records that begin with a 1 so when I export the
contents of the table I only see the records beginning with a 2 in my output
file.
 
Back
Top