View table in edit mode, but lock certain columns

G

Guest

I am using Access 2003 on Windows XP.

Is it possible, using VBA particularly, to display a table in Datasheet
view, but lock a couple columns from view and/or from editing, while leaving
all other data editable?

If so, could someone please post example code on how to do this?

Thanks much in advance.
 
S

Steve Schapel

Quartz,

If you are looking for VBA code, you would be better to post in another
newsgroup. The focus of this newsgroup is macros, which is not related
to VBA code.

Tables are generally regarded as not applicable for human consumption,
i.e. their purpose is data storage. Data viewing/entering/editing is
normally the province of forms.

Having said that, it is possible to have a form display as a datasheet.

The usual way to not show a column from the table or query is to simply
not include it in the design of the form.

For controls on the form for fields that you want to display but not
allow to ber edited, you can set the Locked property to Yes, and also
perhaps the Enabled property set to No. This can be done in the design
view of the form.

If you need to modify these properties at runtime, you can use a macro
using the SetValue action. Or, as you suggest, you could also use a VBA
procedure. The code might look something like this...
Me.NameOfControl.Locked = True
 

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