Differences between an .mdb and an .accdb file

Just starting out? Need help? Post your questions and find answers here.
Arcee_uk
User
User
Posts: 29
Joined: Fri Jul 25, 2008 6:09 am
Location: England

Differences between an .mdb and an .accdb file

Post by Arcee_uk »

Hi people,

Been a while since I was last on here (over a year I think...), so I am very rusty at all this and trying to find my feet again.

Can someone clarify something for me which I am confused about.

I am going to be reading and writing to some database files created in Microsoft Access. If I save them as the old style .mdb files I can access them perfect, if they are in the newer .accdb format Purebasic will not open the file an error reported.

My code (which is a simple proof of concept idea at the moment) is this:

Code: Select all

Global curdir.s, imgdir.s
Global TotalEntries=0
Global Dataread.s

curdir.s=Space(250)
GetCurrentDirectory_(250,@curdir)

If Right(curdir,1)<>"\"
curdir+"\Data\"
imgdir=curdir+"Images\"
EndIf
Debug curdir
Debug imgdir

UseODBCDatabase()
db=MDB_Connect(curdir,"Armourhide","","")

If db 
 Debug "Database has been opened"  
  Else
  Debug "Database has NOT been opened"  
EndIf 


  If DatabaseQuery(db,"Select * from Teletran order by ID asc;")
While NextDatabaseRow(db)   
Debug "---"
   Dataread=GetDatabaseString(db,1)
Debug "---"
    Wend
  EndIf
CloseDatabase(db)


TotalEntries=Val(Dataread)
Debug Dataread
Debug TotalEntries
I have a few debug commands in there just to make sure values where right and that certain points in the code where reached - normal testing.

I would rather use the .accdb format if possible rather than the .mdb format. Can someone tell me what I am missing to enable me to do this?

Thanks.
Arcee_UK
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Differences between an .mdb and an .accdb file

Post by srod »

I presume the MDB_Connect() function is creating a DSN-less connection. In which case the connection string needs to specifically list the driver as "Microsoft Access Driver (*.mdb, *.accdb)".

See Marco 2007's and Fluid-byte's responses in one of your own threads :

http://www.purebasic.fr/english/viewtop ... ilit=accdb
I may look like a mule, but I'm not a complete ass.
Arcee_uk
User
User
Posts: 29
Joined: Fri Jul 25, 2008 6:09 am
Location: England

Re: Differences between an .mdb and an .accdb file

Post by Arcee_uk »

srod wrote:I presume the MDB_Connect() function is creating a DSN-less connection. In which case the connection string needs to specifically list the driver as "Microsoft Access Driver (*.mdb, *.accdb)".

See Marco 2007's and Fluid-byte's responses in one of your own threads :

http://www.purebasic.fr/english/viewtop ... ilit=accdb

Wow. Thanks. I did not know I had asked this before (I did not get any thread updates or anything) and with that topic is over a year old which would explain why I cannot remember back that far.

I will take a look at it now and see what I can make of it.

Thank you for the help and sorry for double posting in effect.

Arcee
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Differences between an .mdb and an .accdb file

Post by srod »

No probs. Truth is that the .accdb stuff was only recently added to that thread anyhow. :)
I may look like a mule, but I'm not a complete ass.
Post Reply