Using Recordset in split Database (1 Viewer)

John thomas

Registered User.
Local time
Yesterday, 16:52
Joined
Sep 4, 2012
Messages
206
I m new to record sets and need help Please
The code underneath works well in a unsplit data base but in my split data base does not work
I tried to find the answer and it seems you have to alter the code for split databases
Would it be possible for someone to alter this code so that it works

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rsFiltered As DAO.Recordset
Dim strSQL As String
Dim i As Integer

strSQL = "SELECT tblClass.ClassID, tblClass.ClassDate, tblClass.ClassDate;"



Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
Many Thanks John
 

moke123

AWF VIP
Local time
Yesterday, 19:52
Joined
Jan 11, 2013
Messages
3,935
strSQL = "SELECT ClassID, ClassDate from tblClass;"
 

John thomas

Registered User.
Local time
Yesterday, 16:52
Joined
Sep 4, 2012
Messages
206
Sorry moke I dont understand your reply
I believe ts all about setting the early parts to dynasett or something like that as when a data base is split the tables become attached and cause the code to fail
Thanks for your help
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 09:52
Joined
Jan 20, 2009
Messages
12,854
Sorry moke I dont understand your reply
I believe ts all about setting the early parts to dynasett or something like that as when a data base is split the tables become attached and cause the code to fail
Thanks for your help

That isn't the issue. Your SQL command is wrong as it doesn't have a FROM clause. Use what Moke posted.
 

Cronk

Registered User.
Local time
Today, 09:52
Joined
Jul 4, 2013
Messages
2,774
And to add further.

While you are getting on top of opening recordsets in vba, you can first create a query in design mode then look at the SQL which has been generated.

Conversely, you could paste any non working sql from your code into the SQL window and let Access tell you what is wrong with it.
 

moke123

AWF VIP
Local time
Yesterday, 19:52
Joined
Jan 11, 2013
Messages
3,935
JT,
I think you may be thinking of DBOpenTable which will fail with linked tables.
 

John thomas

Registered User.
Local time
Yesterday, 16:52
Joined
Sep 4, 2012
Messages
206
Hi Moke I should have looked closer at your reply ,Sorry.
Will give it a go and let you know
All The Best John
 

Users who are viewing this thread

Top Bottom