2105 "You can't go to the specified record" - but a record operation is not in process

L

Larry Mehl

Hello --

This problem recently appeared, after the form (in the front end) had been
working for a long time.

The error occurs in the Form_Load event, before encountering any code
related to a record operation.

frmSelectLot contains a control, txtSearchText,
in which the user enters some text to filter what appears in
listbox lstLotsAvailable from which a record is selected, for further
processing.
The error occurs in line 130 or 150.

Private Sub Form_Load()
'generic form for selecting a single or multiple lot(s) for further
processing, printing, etc.
30 On Error GoTo Form_Load_Error
40 Forms("frmSelectLot").Section(0).BackColor = -2147483633
50 Me.lstLotsAvailable.BackColor = -2147483633

110 Me.lstLotsAvailable.RowSource = g_strSQLLstSource 'global
variable

120 Me.txtSearchText = ""
'error occurs on next line
130 Me.lstLotsAvailable.SetFocus
140 Me.txtSearchText.AutoTab = True
'error occurs on next line
150 Me.txtSearchText.SetFocus
....

I have compacted the mdb and imported the from from a backup version of the
front end mdb.

Can someone tell me what might be happening to make ACCESS think I want to
move to a record?

Is this an example of an error message which does not mean what it says?

Thanks in advance for any help.

Larry Mehl
 
A

Allen Browne

Does this error only occur if the form is opened without any records, not
even the new record?

For example, if the form's RecordSource is a read-only query or its
AllowAdditions is No, and the form is filtered or has its DataEntry set to
Yes, then there are no records to display. The form's Detail section goes
completely blank, and Access flunks out when you try to refer to the
controls. More info on this problem:
http://allenbrowne.com/bug-06.html

If that is not the issue, can you confirm that:
a) txtSearchText and lstLotsAvailable are both unbound (so setting their
value is not dirtying the record), and

b) The RecordSource of the form does not refer to either control (which
could give a circular reference here.)

It's not clear why:
a) You are assigning a zero-length string to the text box instead of leaving
it Null (or at worst setting a Default Value if there is a particular reason
for doing so), and

b) You are setting focus to the list box, and then to the text box.

It is also possible that other code (e.g. the GotFocus or Enter event of the
controls, or the Current event of the Form) could be interferring.
 

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