Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2007

Tip: Looking for answers? Try searching our database.

Delete the last record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
morgan - 13 Nov 2007 16:22 GMT
Hello everybody, I'm making my MP3 collection db importing xls files created
by an MP3 tag editor. I have the following code to append the xls file to my
access table and everything work fine. Since the last row of the xls file is
always "this list has been created with..." I'd like to modify the code to
delete the last record appended on my access table and then refresh the form,
in order to get immeditely the new records. I'm using access 2003.
Tks in advance

Private Sub Comando10_Click()

   Dim dlg As FileDialog
   Dim Importfile As String

   Set dlg = Application.FileDialog(msoFileDialogFilePicker)
   With dlg
       .Title = "Select the Excelfile to import"
       .AllowMultiSelect = False
       .Filters.Clear
       .Filters.Add "Excel Files", "*.xls", 1
       .Filters.Add "All Files", "*.*", 2
       If .Show = -1 Then
           Importfile = .SelectedItems(1)
           
       DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
"Db_MP3", Importfile, True, "A1:E1000"
       Else
           Exit Sub
       End If
   End With

End Sub
John Spencer - 13 Nov 2007 17:26 GMT
Why not run a delete query that deletes any record that has the Phrase "This
List has been created "

You can probably just add the following line (all one line) of code to your
current code.

CurrentDb().Execute "DELETE FROM db_MP3 WHERE [Somefield] Like 'This List
has been created*'"

Signature

John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
.

> Hello everybody, I'm making my MP3 collection db importing xls files
> created
[quoted text clipped - 31 lines]
>
> End Sub
morgan - 15 Nov 2007 07:45 GMT
Hi John, sometimes i try to complicate my life....
Tks

> Why not run a delete query that deletes any record that has the Phrase "This
> List has been created "
[quoted text clipped - 40 lines]
> >
> > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.