Lock specific columns in a table when opening directly

G

Guest

First let me apologize for cross posting, I first posted in another area,
then realized that this would probably be a better forum for my question, so
please excuse this.

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.
 
G

Guest

Hi quartz,

If you look at the form in design view, select the textbox relating to the
column you want to lock, then on the 'Data' tab of Properties, choose either
Enabled = False (greys out the field and prevents entry / editing) or Locked
= True (Looks normal, but user cannot change data) or use both together.

TonyT..
 
G

Guest

Thanks Tony, but I'm looking directly at the Table object, not a form...any
further ideas?
 
G

Guest

Hi quartz,

I'm confused, a datasheet view is a form's way of displaying table data,
with all the added functionality of events and so forth, what are you
actually trying to acheive?

TonyT..
 
J

John Spencer

No, not if you are working directly with the table.

With a form datasheet view and a query as the recordsource there are some
things you can do.

One method, make the field you want locked a calculated field (multiply it
by 1) or add a zero-length string to the end of a text field. For instance
the following query is updatable, but you can't change the information in
the first column

SELECT[ContactNumbers].[FirstName]+"" AS FirstName
, [ContactNumbers].LastName
, [ContactNumbers].WorkPhone
, [ContactNumbers].HomePhone
FROM [ContactNumbers]
 

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