protect field on a query

G

George Applegate

I have a query I run, which displays records form linked tables.

Right now I display most of the fields, and the user can change any of
them. Is there a way to be able to DISPLAY some fields, like a date,
a time, a location field, but not allow those fields to be changed,
yet allow the user to change other fields on the records retrieved?

Second question. If I use this same query to populate records for a
form (add mode), in that situation I want to allow the user to be able
to add a date, time and location, along with the other fields. Is
that possible?

thanks for any suggestios!
ga

George Applegate
(e-mail address removed)
 
R

Rick Brandt

I have a query I run, which displays records form linked tables.

Right now I display most of the fields, and the user can change any of
them. Is there a way to be able to DISPLAY some fields, like a date, a
time, a location field, but not allow those fields to be changed, yet
allow the user to change other fields on the records retrieved?

Base any field you want to be read-only on an expression. For dates use
DateAdd() to add zero days. For numbers add a zero. For text Append
"". Anything really that makes the field an expression rather than a
direct field reference will render that field non-editable in the result-
set. Of course you want to use very simple expressions that won't take
much processing power and you (probably) don't want the Data Type to
change.
Second question. If I use this same query to populate records for a
form (add mode), in that situation I want to allow the user to be able
to add a date, time and location, along with the other fields. Is that
possible?

Queries are cheap. Make a separate one for that.
 
R

Rick

I have a query I run, which displays records form linked tables.

Right now I display most of the fields, and the user can change any of
them.  Is there a way to be able to DISPLAY some fields, like a date,
a time, a location field, but not allow those fields to be changed,
yet allow the user to change other fields on the records retrieved?

Second question.  If I use this same query to populate records for a
form (add mode), in that situation I want to allow the user to be able
to add a date, time and location, along with the other fields.  Is
that possible?

thanks for any suggestios!
ga

George Applegate
(e-mail address removed)

Generally would use a form for presenting the data to users (not allow
them to directly open a query) and since you already have a form to
add data it doesn't take much to use for both adding and editing
records. Once in the form you can control what fields can be updated
by setting the Enabled and/ Locked property for each field you want
locked. These properties are on the Data tab of the property or you
can set them with some simple VBA code.



Rick
 

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