Error 2185 on Snapshot form

B

Brian

I have a bound form that has several unbound controls in the header that are
used only to filter the records on the form. The detail section has only one
bound field enabled, and its only function is to allow the user to
double-click it to open a detail form filtered to the record on which the
user double-clicked.

I have AllowDeletions = False, AllowAdditions = False, and RecordsetType =
Snapshot because this is not an input form, just a search form.

Now, in all my filtering controls, I have code similar to this to drop down
the control on the first key press:

If Len(ThisControl.Text) = 0 And KeyAscii <> 9 And KeyAscii <> 27 Then
ThisControl.Dropdown 'dropdown on first character unless it is TAB/ESC

I get an error 2185 - "can't reference a control unless it has the focus"
when I press a key while in the unbound control. I do not get this error when
I set AllowAdditions to True, but then the form confusingly shows a blank
record with (AutoNumber) in the detail section and, of course, blows up when
I try to pass that value to the other form on the double-click.

The problem is apparently related to the fact that there is no current
record to display when AllowAdditions is set to Fale. The problem occurs only
when the current filter results in the display of 0 records.
 

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