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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL, Please help :)

Status
Not open for further replies.

Sworkman

Programmer
Apr 27, 2006
1
GB
Hi People.

Wondering if you can help me here.

A while ago i wrote a VBA macro for Microsoft excel that contained the following statement:

For i = 1 To LastRow
If Application.CountIf([A15:A10000], Cells(i, "A")) = 1 And _
Left(Cells(i, "E"), 2) = 75 Or Len(Cells(i, "E")) = 10 Then Cells(i, "F").Value = "TAKE OUT"
Next i

Now that we have decided to transfer everything to access im totally stumped on how to include the equivalent
of the above statement into the Where clause of an SQL Statement.

I dont need to write "TAKE OUT" into a table field, all i need to do is transfer to a new table as long
as the criteria is met.

Any help would be much appreciated.

Thankyou.

Scott.
 
Hi

Your Columns will become fields within an Access Table

So something like

INSERT INTO MyTable1 SELECT * FROM MyTable WHERE Left(Col1,2) = '75' OR Len(Col2) = 10;

Would do the transfer

To delete the rows from table you would needa delete query something like

DELETE FROM MyTable WHERE Left(Col1,2) = '75' OR Len(Col2) = 10;

Note this is the gist of how you do it, you need to substitute your own table and column names

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top