Find dialog and What's this question mark exposes Replace?

M

mjt7email-ggroups

Hello Everyone

I'm using Access 2003.

On Allen Browne's site http://allenbrowne.com/tips.html under the
heading "Find Dialog", Allen advises that the Replace tab is also
exposed and (quote) "A workaround for this behavior is to temporarily
set the AllowEdits property of the form to No before you
DoCmd.RunCommand acCmdFind."

I was testing it and everything was working well until I clicked the
What's this question mark in the dialog tile bar...the Replace tab
became available, and not just available but in full working order
too.

The code I'm using is -

Private Sub cmdFind_Click()
On Error GoTo Err_Handler

Me.AllowEdits = False
DoCmd.RunCommand acCmdFind

Exit_Here:
On Error Resume Next
Me.AllowEdits = True
Exit Sub

Err_Handler:
MsgBox Err.Number & " : " & Err.Description, , dbTitle
Resume Exit_Here
End Sub

Can you tell me if the code is correct please?

Thank you for your help, regards
Marguerite
 
A

Allen Browne

Interesting bug, Marguerite. I was able to confirm this problem occurs in
both Access 2003 and 2007

On a form that has AllowEdits set to No, when you open the Find dialog, the
Replace tab is hidden. But if you click on the 'What's This' button
(question mark at right of Find dialog's title bar), and then click in
Match, then:
a) the Replace tab becomes visible, and
b) the form's AllowEdits property is set to True.

AFAIK, there is no workaround for this workaround, other than to avoid using
the built-in Find dialog.
 
M

mjt7email-ggroups

Hello Allen

Thank you for your reply, and apologies for the incorrect link in my
question - the main page IS an excellent resource but not the relevant
one!

At least it wasn't the code<s>.

Regards
Marguerite
 
P

Paul Shapiro

Instead of setting AllowEdits false you could write a fairly simple routine
that loops through the form and sets every editable control to Locked =
True. In the code, test for control type (ignoring labels, command buttons,
etc.) so one routine can work on any form. I have a routine like that for
limiting the editing available to certain users. Test first to see if a
locked control is actually protected from Replace because I haven't tried
that.
 
M

mjt7email-ggroups

Hello Allen

Thank you for the link, I might use it one day, but not for this - I
was only playing/testing the behaviour in 2003 (I'm stuck in a time
warp and am still using Access 97).

Actually, I had tried looping through the controls to lock them
individually (impatient, brute force method using on error resume
next!) before I posted the question and it didn't work either, so then
I wondered if I understood the instruction at all.

If I was *really* dedicated to the learning process I would test your
sophisticated solution, but I'm often lazy<s>

Regards
Marguerite
 

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