Android Question Record not found (jackcess)

dibesw

Active Member
Licensed User
Longtime User
This code works well if cursor found any records.
B4X:
Dim IndVal As Object
Dim targetDate As Long = DateUtils.SetDate(2013, 6, 1)

Table.Initialize(Access.GetTable("TAB"))
Index.Initialize(TableEnt.GetIndex("CODE_DT"))
Cursor.Initialize(TableEnt.GetTable, IndexEnt.GetIndex)
IndVal=targetDate
Cursor.FindClosestRowByEntry(Array As Object(IndVal))
Do Until CursorEnt.IsAfterLast
      .....
      (If condition Then Exit)
      .....
      CursorEnt.GetNextRow
Loop
But if cursor does not find any record (no records >= CODE_DT)
Cursor.FindClosestRowByEntry(Array As Object(IndVal))
have immediatly this error:

screenshot.jpg


I have need read this table with >=
and then to do readnext.
Can anyone help me who has had experience with jackcess?:(
 

dibesw

Active Member
Licensed User
Longtime User
I modified the code

B4X:
Dim IndVal As Object
Dim targetDate As Long = DateUtils.SetDate(2013, 6, 1)

Table.Initialize(Access.GetTable("TAB"))
Index.Initialize(TableEnt.GetIndex("CODE_DT"))
Cursor.Initialize(TableEnt.GetTable, IndexEnt.GetIndex)
IndVal=targetDate
Cursor.FindClosestRowByEntry(Array As Object(IndVal))
Msgbox(CursorEnt.IsBeforeFirst,"")
Msgbox(CursorEnt.IsAfterLast,"")
Do Until CursorEnt.IsAfterLast
      .....
      (If condition Then Exit)
      .....
      CursorEnt.GetNextRow
Loop

when give error I press button YES (continue yes)
but not have msgbox
 
Upvote 0

dibesw

Active Member
Licensed User
Longtime User
I thing that is a Jackaccess bug.
I post my code (with mdb access).
In the code there is a test.
Try...
B4X:
Dim targetDate As Long = DateUtils.SetDate(2013, 6, 1)
Program read a table with key >= DATE
This test (targetDate=2013/6/1) works well.

If you try targetDate=2013/7/1 (or major) that not exits, program give this error

screenshot.jpg


THANKS!!
 

Attachments

  • testjackcess.zip
    84.1 KB · Views: 213
Upvote 0
Top