Problems reading a .mdb database.
Posted: Mon Nov 21, 2005 1:53 pm
I am using a .mdb database created in Microsoft Access to store reference data for my program. It has three sepereate titles in it which are accessed on program start up and the data stored ready for use.
When I try and access one of the titles (the first one) within the database my code starts at Row 6 and reads everything in and once it gets to the end, it then goes back and reads the first 5 rows and puts them on the end.
This is the code I use to read the information from the title (note the Debug commands are how I figured out it is reading the information wrong):
When I view the database in Access the first entry starts "Blue" with row 6 starting "Orange". But this code always reads "Orange" as the first entry. I tried using the PreviousDatabaseRow() & FirstDatabaseRow() commands to make sure I was at the beginning of the file, but they made no difference.
Does anyone know why this is happening. When I access the other two titles I do not get this problem, only with this one for some reason.
Any thoughts would be welcomed as I am totaly lost on this at the moment.
Thanks
Andy
When I try and access one of the titles (the first one) within the database my code starts at Row 6 and reads everything in and once it gets to the end, it then goes back and reads the first 5 rows and puts them on the end.
This is the code I use to read the information from the title (note the Debug commands are how I figured out it is reading the information wrong):
Code: Select all
TableName.s = "AccInfo"
If DatabaseQuery("SELECT * FROM [" + TableName.s + "]")
Columns= DatabaseColumns() ; How many columns/fields (across) in the table
EndIf
; Now take the same sub-database and display it's contents!
Count1 =1
If DatabaseQuery("SELECT * FROM [" + TableName.s + "];")
While NextDatabaseRow()
For Count= 0 To 20
DumpString.s = GetDatabaseString(Count)
Debug "Count1 = "+Str(Count1)+" Acc:"+DumpString.s
Accessories (Count1,Count) = DumpString.s
DumpString.s = ""
Next Count
For count = 21 To 28
DumpString.s = GetDatabaseString(Count)
Debug "Count1 = "+Str(Count1)+" Var:"+DumpString.s
Variant (Count1,Count-20) = DumpStrong.s
DumpString.s = ""
Next Count
Count1 = Count1 + 1
Wend
EndIf
Does anyone know why this is happening. When I access the other two titles I do not get this problem, only with this one for some reason.
Any thoughts would be welcomed as I am totaly lost on this at the moment.
Thanks
Andy