Search form without allowing edits, deletions or additions

S

Sandy

I have a form which has a search combo box attached.

I would like this form to be searched only, with no amendments,deletions,
additions or otherwise. If I set 'Allow Edits', 'Allow Deletions', 'Allow
Additions' and 'Data Entry' to "No" then the combo search does not work. If
I 'Allow Edits' it does but then users can adjust the records.

Is it possible to allow this search to take place without the possibility of
any amendment being made?

Sandy
 
L

Lance

Define "doesn't work," does it give an error message or just not search?

Is the control source of your search combobox set to one of the fields of
the table underlaying your form?
 
S

Sandy

Hi Lance

I can select in the combo but the form does nothing.

The combo was created by the wizard and is created from
'qry_Contact_Details' and the RowSource is as follows :-

SELECT qry_Contact_Details.JobID, qry_Contact_Details.LastName,
qry_Contact_Details.FirstName FROM qry_Contact_Details;

There is also a subform.

It crossed my mind that really what I am after is read-only, but how would I
do that?

Sandy
 
T

Tony Toews [MVP]

Sandy said:
I would like this form to be searched only, with no amendments,deletions,
additions or otherwise. If I set 'Allow Edits', 'Allow Deletions', 'Allow
Additions' and 'Data Entry' to "No" then the combo search does not work. If
I 'Allow Edits' it does but then users can adjust the records.

You have to allow edits to search. However you then select all your
bound controls and change the Enabled property to No and Locked to
Yes. I do this as a matter of course on many of my view only forms.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
L

Lance

I was just wondering if your combobox was bound.. but tony seems to have a
better direction to look at than I do.
 
S

Sandy

So simple its brilliant Tony, I guess that's what makes you guys MVP's
<smile>.
Thank you.
Sandy
 
J

John W. Vinson

I have a form which has a search combo box attached.

I would like this form to be searched only, with no amendments,deletions,
additions or otherwise. If I set 'Allow Edits', 'Allow Deletions', 'Allow
Additions' and 'Data Entry' to "No" then the combo search does not work. If
I 'Allow Edits' it does but then users can adjust the records.

Is it possible to allow this search to take place without the possibility of
any amendment being made?

Sandy

A couple of ways. One would be to base it on a query which is not updateable
(this is easily done by including the Primary Key field and setting the
query's Unique Values property to Yes); another would be to cancel any updates
in the Form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel as Integer)
Me.Undo
End Sub

John W. Vinson [MVP]
 
M

Maarkr

how do you get the form (subform) to accept edits if you open it using the
before_update method?
 

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