First, had to use Linked Table Manager to link your included BE. Then followed instructions, and no error occurred. I was able to do anything I wanted at the Stop. Then pressed F5 and code ran OK to End Sub. No errors at all.
First, had to use Linked Table Manager to link your included BE. Then followed instructions, and no error occurred. I was able to do anything I wanted at the Stop. Then pressed F5 and code ran OK to End Sub. No errors at all.
What did you link to ? I added links to Disk and Tracks in Olist_BE then with the Stop highlit,I typed something under it and the error occurred.
AFAIK both my tables are correctly linked. I can open and view them.
So for you there is no error. Wow ! That wasn't expected.
Look at post#18. The tables shown are not Disks and Tracks, they are mp3Disks and mp3Tracks. All the queries expect those tables also. There are no tables named Disk or Tracks. Those two tables are in OList_BE.mdb. I don't know why you included that file in the Zip.
The FE database is Listtest.accdb and it expects its BE to be mp3ListBE.mdb.
If you linked the FE to tables DIsk and Tracks in OList_BE.mdb, and it runs at all, then you uploaded the wrong FE.
I linked to Disk and Tracks after your msg 16. The others were already linked and I thought that's what you meant. Now removed as they're
opened instead in Module 1, Function MyCurrentDB. The name is selected in Frame68_Click
It becomes the Target for data written to the linked tables.
Is that how you see it ? (I'm not the best at descriptions!)
I've narrowed it down to the error occurring in this procedure. I think it has to do with both databases Listtest.accdb and OList_BE.mdb being open at the same time. The code so doing is obtuse (and not actually in the below procedure).
Code:Private Sub btnImport_Click() DoCmd.OpenForm "frmImport", acNormal, , , , acDialog ' If UBound(OtherList) = 0 Then Exit Sub Dim Dat As Boolean Dim SourceFields As String Dat = AllFalse(OtherList) If Dat = True Then Exit Sub 'No Fields to copy selected Dim r As DAO.Recordset Dim ExtDB As DAO.Recordset Dim i As Integer SourceFields = "TTrack, Path, TrackNumber, TTitle, TPerformer, TComposer, Year, Mode, TNotes, Single, AlbumName, AlbumCat, AlbumTrack, Bitrate, Media, TDuration, FileSize" Select Case Split(OtherList(0), " ")(0) Case "Tracks" ThisList = Application.CurrentProject.Path & "\OList_BE.mdb" End Select ' if either of the below lines execute, the error occurs. '>>>>> 'Set ExtDB = CurrentDb.OpenRecordset("SELECT " & SourceFields & " FROM Tracks IN " & Chr$(34) & ThisList & Chr$(34) & " Where Tcat = " & Split(OtherList(0), " ")(1) & " Order By tTrack;") 'Set r = CurrentDb.OpenRecordset("Select TTrack, Path, [Take Number], TTitle, TPerformer, mComposer, Year, Mode, TNotes, TSingle, TLabel, AlbumCat, AlbumTrack, Bitrate, Media, TDuration, FileSize from mp3Tracks Where tCat = " & ThisDisk() & " Order By tTrack;") '>>>>> ' If r.RecordCount <> ExtDB.RecordCount Then MsgBox "Record counts are different, cannot Import": Exit Sub Stop End Sub
ListView-davegri-v01.zip
See attached. Got rid of the code opening the Backend and added code to simply link the tables.
Modified SQL code to accommodate the linked tables without having to specify the BE name.
Added autoexec macro and its runcode, fcnStartup()
Added code module modLinkTables
Replaced a lot of existing code, with reasonably easy to understand code, with some comments
Make sure Backends are in same folder as this Frontend. At BOJ, FE will link the 4 required tables from the 2 Backends.
The error will not appear.
Last edited by davegri; 07-06-2024 at 07:31 PM. Reason: clarif
Dave I don't see that in the db you uploaded . There's just a Form and a listview control.
But you did get the error, my thinking was also the two recordsets were something to do with it but couldn't see how.
Now even more confusion, as a test I linked to Olist and changed the recordset CD to a Database object. That worked.
But as there's 3 other db's in the mix, that meant 6 linked tables and using my method (also tried IN in the swl) seemed more compact.
Next I removed the links and reversed back to get the error again. But now it won't error as works as its should.
So what to make of it all? A pity the error could not be defined. Be nice to know...
I'd like to see what you did though,. Always intriguing to see how someone else does things, I'm self taught and know very little, an easily forget stuff at my age.
That was indeed the wrong DB. It was an earlier file concerning your request for help with the Listview ActiveX control back in February.Dave I don't see that in the db you uploaded . There's just a Form and a listview control.
Here is the correct FE.
Listtest-davegri-v01.zip