Can't use Mouse on Find Dialog

A

Andrew Gabb

I'm tearing my hair out. I've implemented a 'pick list' so that the
users can pick an item from a list, derived from a query. The users
want to use the standard Find and Replace dialog (Ctrl-F) on the
pick form.

Trouble is that they then can't use the mouse on the Find dialog
(but the keyboard works OK).

For reasons discussed in another article, this is a modal form (not
called using acDialog), and the code waits until the form closes
using a DoEvents loop.

While Form_is_loaded
DoEvents
Wend

If I remove this loop (ie don't wait for the form to close) the
mouse works fine.

Any ideas?

Alternately, how else can I wait rather than a DoEvents loop - I
really have to wait in some way - the selection of the item is in
the middle of a rather complex process.

I'm using Access XP.

Andrew
 
B

Brendan Reynolds

I can't say for sure whether this will solve your problem, Andrew, but it is
fairly easy to test, so you might want to give it a try ... does it make any
difference if you use the Windows API Sleep function instead of DoEvents?
You can find code to call the Sleep function at the following URL ...
http://www.mvps.org/access/api/api0021.htm
 
A

Andrew Gabb

Brendan said:
I can't say for sure whether this will solve your problem, Andrew, but it is
fairly easy to test, so you might want to give it a try ... does it make any
difference if you use the Windows API Sleep function instead of DoEvents?
You can find code to call the Sleep function at the following URL ...
http://www.mvps.org/access/api/api0021.htm

If I use Sleep instead of DoEvents it locks up (the pick form does
not get shown). If I include DoEvents plus Sleep the problem is
still there. So I guess the answer is no.

Andrew
 
B

Brendan Reynolds

Sorry Andrew. I'd advise opening the form using acDialog rather than using
the loop with DoEvents, but I gather from your original post that you've
already been given that advise in another thread and for some reason can't
follow it, so I'm afraid I don't know what else to tell you.

There was a possible alternative that Lyle Fairfield suggested in a previous
newsgroup discussion - instead of having code call a form and wait for that
form to close, have the code call the form and stop, but have the form call,
from it's Close event, the code that you want to run after the form is
closed. For example instead of ...

'Form1
MsgBox "Before opening Form2"
DoCmd.OpenForm "Form2"
Do While CurrentProject.AllForms("Form2").IsLoaded
DoEvents
Loop
MsgBox "After closing Form2"

.... you may be able to do something like ...

'Form1
MsgBox "Before opening Form2"
DoCmd.OpenForm "Form2"
'end of Form1 code

'Form2 - Close event procedure
MsgBox "After closing Form2"
 
A

Albert D.Kallal

the selection of the item is in
the middle of a rather complex process.

Hum, lets assume we are in a form:

complex code goes here:

docmd.OpenForm "myPickList"

end sub


Public Function PickContinuecode

......complex code continues

So, my point here is that you can "well" communicate, or pass information,
or call routines both ways between forms....

In form "mypickllist", the "ok" button, or whatever can then call the above
code:


forms!MyMainFrmWithComplexCode.PickContinueCode

so, in our main form with the complex code

dim frmPick as form

set frmPick = forms!myPickList


msgbox "records selected = " & myPickist.MySelectedCount

myPickList.Requery.....etc. etc.

MySelectedCount can be a public function of that picklist form. It can even
return recrdsets, or whatever...

This is basically a case of converting old style procedural code to event
driven style. Each form can call nay of the others form code, and you can
easily share variables between the forms if you declare them as public. And,
any public function in a form becomes a method of that form (my
SelectedCount is a good example).

So, don't make your code "wait", but have it respond, and "continue" based
on actions in the pick list form...

Last, but not least, you might build nice search form, and eliminate the
find dialog anyway (I find that new users don't like that dialog anyway).
I got some screen shots here of this idea:
http://www.members.shaw.ca/AlbertKallal/Search/index.html
 
Top