I'm pretty new here. I am try to read a database file made in Access 2007 (with a accdb extention and not the more common .mdb).
I found a old post about reading data from the db but I cannot get it toowork. The program opens the database then seems to do nothing and the closes it off. It does not appear to displauy any text in the debug window as I expected it too..
The code l0oks like this:
Code: Select all
; Open Main database file
Result = UseSQLiteDatabase()
If Result=0
MessageRequester("Cannot init database","Cannot Initalise database.",#PB_MessageRequester_Ok)
End
EndIf
Result = OpenDatabase(#PB_Any,"Data\mdb.accdb","Prefill","")
TableName.s = "Prefill"
If DatabaseQuery(Result, "SELECT * FROM [" + TableName.s + "]")
Columns= DatabaseColumns(Result) ; How many columns/fields (across) in the table
EndIf
; Now take the same sub-database and display it's contents!
Count1 =1
If DatabaseQuery(Result, "SELECT * FROM [" + TableName.s + "] ORDER BY [ID]")
While NextDatabaseRow(Reslt)
For Count= 0 To 41
DumpString.s = GetDatabaseString(Result, Count)
Debug "Count1 = "+Str(Count1)+" "+DumpString.s
DumpString.s = ""
Next Count
Count1 = Count1 + 1
Wend
EndIf
MessageRequester("Database found","Database opened.",#PB_MessageRequester_Ok)
If anyone has any ideas I really appreicate it.
Many thanks
Arcee