Re: Form View using snapshot?



A fairly simple workaround is to set the Locked property of the bound controls instead of trying to modify the type of recordset the form uses.

As well as solving your immediate problem, this also avoids the display bugs that occur in Access when the Detail section of a form goes completely blank (because there were no records to show, and you can't add new records to the read-only recordset), and so it also gets confused about the controls in the (still visible) form header/footer.

Here's an example of code that loops through the controls on a form and locks/unlocks the bound controls:
http://allenbrowne.com/ser-56.html
The example shows how to set this up with the click of a button, but in your case you probably want to do this by passing something in the OpenArgs of OpenForm, and then responding to it in Form_Open (or possibly by setting a public variaable.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Bobbye R" <BobbyeR@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0A0B49E1-433E-4646-93DF-987BF43A569B@xxxxxxxxxxxxxxxx
I have one form. On the switchboard I have three choices. Add, Edit or
Search the form.
The add and edit work fine. My problem is with the search. If I open the
form in edit mode and manually change the recordset to snapshot I get what I
want which is to have the user search the form, still use the filter command
buttons on the form and not be able to make any changes to the textboxes on
the form.
I tried to write a sub procedure to do this automatically but I don't
understand what I'm doing. I also tried DoCmd in acReadOnly but it would not
allow me to use the filters on the form. I either need help writing a
procedure or a suggestion on another approach.

--
Access 2003 User, Thanks in advance Bobbye

.


Loading