Please help with bookmark problem

I

Ian Baker

I have a client that is experiencing a strange problem using Access 2k & Win
2k on a networked backend/frontend. The scenario is:
1. There is a form which contains fields, a listbox and 2 buttons and is
bound to [tblHelpDesk].
2. The listbox souce is bound to a query based on the same table
[tblHelpDesk] but with set criteria.
3. When a user clicks btnOpenCalls the listbox source changes to
qryOpenCalls to display in the listbox all help desk calls that are open and
when the user clicks btnClosedCalls the listbox source changes to
qryClosedCalls to display all help desk calls in the listbox that are
closed.
4. The user can then click one of the records in the list box and the form
will display the selected record's details using bookmark in the following
code of the On_Click event:

Private Sub CallList_Click()
On Error GoTo HandleErr
Dim rst As Recordset

Set rst = Me.RecordsetClone

rst.FindFirst "CallID = " & Me!CallList
Me.Bookmark = rst.Bookmark

rst.Close
Set rst = Nothing

ExitHere:
Exit Sub
HandleErr:
If Err = 94 Then
CallList = Null
ElseIf Err = 2105 Then
Exit Sub
Else
StandardError Err, Err.Description, "Help Desk - CallList_Click"
End If
Exit Sub

End Sub

The problem is this works fine most of the time with the user clicking any
one of the records in the listbox which may contain 50 or so records and the
form will display the selected record's details. But every now and then the
last couple of records in the listbox (different number each time) when
clicked will always display on the form the very first record that is in the
table and not the one selected. To explain in another way the user can
select say for example any one of the top records in the listbox and the
form displays the corresponding record but when they select any one of the
last few records in the listbox the form displays record 1 of the table.
This doesn't happen everytime.

This is really frustrating me as I have spent a huge amount of time trying
to resolve it but now I am totally lost. Please, if you can offer any advise
then I am greatly indebted.

--
Regards
Ian Baker
Jackaroo Developments Pty Ltd
(Download Jackaroo IT - IT Mgmt and Help Desk application at
http://jackaroo.net.au)
 
J

JR

Hi Ian,

Visit the folks at http://www.mvps.org/access/bugs/bugs0012.htm
They have sme info on the "bookmark bug" that may help!

--

Jamie :blush:)
I have a client that is experiencing a strange problem using Access 2k & Win
2k on a networked backend/frontend. The scenario is:
1. There is a form which contains fields, a listbox and 2 buttons and is
bound to [tblHelpDesk].
2. The listbox souce is bound to a query based on the same table
[tblHelpDesk] but with set criteria.
3. When a user clicks btnOpenCalls the listbox source changes to
qryOpenCalls to display in the listbox all help desk calls that are open and
when the user clicks btnClosedCalls the listbox source changes to
qryClosedCalls to display all help desk calls in the listbox that are
closed.
4. The user can then click one of the records in the list box and the form
will display the selected record's details using bookmark in the following
code of the On_Click event:

Private Sub CallList_Click()
On Error GoTo HandleErr
Dim rst As Recordset

Set rst = Me.RecordsetClone

rst.FindFirst "CallID = " & Me!CallList
Me.Bookmark = rst.Bookmark

rst.Close
Set rst = Nothing

ExitHere:
Exit Sub
HandleErr:
If Err = 94 Then
CallList = Null
ElseIf Err = 2105 Then
Exit Sub
Else
StandardError Err, Err.Description, "Help Desk - CallList_Click"
End If
Exit Sub

End Sub

The problem is this works fine most of the time with the user clicking any
one of the records in the listbox which may contain 50 or so records and the
form will display the selected record's details. But every now and then the
last couple of records in the listbox (different number each time) when
clicked will always display on the form the very first record that is in the
table and not the one selected. To explain in another way the user can
select say for example any one of the top records in the listbox and the
form displays the corresponding record but when they select any one of the
last few records in the listbox the form displays record 1 of the table.
This doesn't happen everytime.

This is really frustrating me as I have spent a huge amount of time trying
to resolve it but now I am totally lost. Please, if you can offer any advise
then I am greatly indebted.

--
Regards
Ian Baker
Jackaroo Developments Pty Ltd
(Download Jackaroo IT - IT Mgmt and Help Desk application at
http://jackaroo.net.au)
 
D

Dirk Goldgar

Ian Baker said:
I have a client that is experiencing a strange problem using Access
2k & Win 2k on a networked backend/frontend. The scenario is:
1. There is a form which contains fields, a listbox and 2 buttons and
is bound to [tblHelpDesk].
2. The listbox souce is bound to a query based on the same table
[tblHelpDesk] but with set criteria.
3. When a user clicks btnOpenCalls the listbox source changes to
qryOpenCalls to display in the listbox all help desk calls that are
open and when the user clicks btnClosedCalls the listbox source
changes to qryClosedCalls to display all help desk calls in the
listbox that are closed.
4. The user can then click one of the records in the list box and the
form will display the selected record's details using bookmark in the
following code of the On_Click event:

Private Sub CallList_Click()
On Error GoTo HandleErr
Dim rst As Recordset

Set rst = Me.RecordsetClone

rst.FindFirst "CallID = " & Me!CallList
Me.Bookmark = rst.Bookmark

rst.Close
Set rst = Nothing

ExitHere:
Exit Sub
HandleErr:
If Err = 94 Then
CallList = Null
ElseIf Err = 2105 Then
Exit Sub
Else
StandardError Err, Err.Description, "Help Desk -
CallList_Click" End If
Exit Sub

End Sub

The problem is this works fine most of the time with the user
clicking any one of the records in the listbox which may contain 50
or so records and the form will display the selected record's
details. But every now and then the last couple of records in the
listbox (different number each time) when clicked will always display
on the form the very first record that is in the table and not the
one selected. To explain in another way the user can select say for
example any one of the top records in the listbox and the form
displays the corresponding record but when they select any one of the
last few records in the listbox the form displays record 1 of the
table. This doesn't happen everytime.

This is really frustrating me as I have spent a huge amount of time
trying to resolve it but now I am totally lost. Please, if you can
offer any advise then I am greatly indebted.

The first thing I'd do is modify your code to check for the possibility
that the record that was clicked in the list box was not found by the
call to rst.FindFirst. If it isn't, I'd guess that the records were
newly added to tblHelpDesk by another user, and therefore aren't in the
form's recordset. So I'd requery the form and try again:

rst.FindFirst "CallID = " & Me!CallList
If rst.NoMatch Then
' Oops, form is out of date.
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "CallID = " & Me!CallList
End If

If rst.NoMatch Then
MsgBox "Something's wrong -- I can't find that record!"
Else
Me.Bookmark = rst.Bookmark
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top