Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Lock records based on textbox value?

Discussion in 'Information Technology' started by default105, Jul 28, 2006.

  1. default105

    default105
    Expand Collapse
    Guest

    Is there an easy way to locked a records textboxes based on a value in one of
    the textbox fields.

    I have done this before but only ever had to protect 2 -5 fields from being
    accidently changed by creating a private sub that looked at a value in a
    field and changed the items to be locked properties if was true, then called
    that sub from the on current event. This probably is not the correct way and
    I way hoping someone could tell me how to do this better on a broader scale.
    I used before a option button to allow the users to edit the locked fields
    because sometime things may need to changed. I am using this as a "protect
    data" from accidently being changed.

    Thanks in advance.

    Pete
     
  2. Loading...

    Similar Threads Forum Date
    Debate With Sarbjeet Singh Dhunda At Turlock (California) Gurdwara, April 2015 - YouTube Gurmat Vichaar Apr 23, 2016
    Uk clocks go back Blogs Oct 17, 2015
    Kesh: Dreadlocks Questions and Answers Nov 20, 2013
    Obamacare Faces Near-Solid Block In The South Health & Nutrition Mar 31, 2013
    Malaysia Have you forsaken your flock, Archbishop? Malaysia News Update Breaking News Jan 30, 2013

  3. PC Datasheet

    PC Datasheet
    Expand Collapse
    Guest

    You don't want to just lock the textbox, you want to disable it too.

    If Me!Textbox1 = X Then
    Me!TextBox2.enabled = False
    Me!Textbox2.locked = True
    Else
    Me!TextBox2.enabled = True
    Me!Textbox2.locked = False
    End If


    --
    PC Datasheet
    Your Resource For Help With Access, Excel And Word Applications
    Over 1175 users have come to me from the newsgroups requesting help
    resource@pcdatasheet.com




    "default105" <default105@discussions.microsoft.com> wrote in message
    news:7AA9CC4D-5919-465D-920B-B4070F95A399@microsoft.com...
    > Is there an easy way to locked a records textboxes based on a value in one
    > of
    > the textbox fields.
    >
    > I have done this before but only ever had to protect 2 -5 fields from
    > being
    > accidently changed by creating a private sub that looked at a value in a
    > field and changed the items to be locked properties if was true, then
    > called
    > that sub from the on current event. This probably is not the correct way
    > and
    > I way hoping someone could tell me how to do this better on a broader
    > scale.
    > I used before a option button to allow the users to edit the locked fields
    > because sometime things may need to changed. I am using this as a
    > "protect
    > data" from accidently being changed.
    >
    > Thanks in advance.
    >
    > Pete
     
  4. default105

    default105
    Expand Collapse
    Guest

    PC,
    I realized that and that is the format I usually use. I was trying to
    condense the question and as I did already today when trying to help out
    someone else. Dumb on my part. I just was wondering if there was a better
    way to do this with multiple textboxes for example say 20 of them instead of
    code eating up 2 page heights.

    Thanks for the quick response

    "PC Datasheet" wrote:

    > You don't want to just lock the textbox, you want to disable it too.
    >
    > If Me!Textbox1 = X Then
    > Me!TextBox2.enabled = False
    > Me!Textbox2.locked = True
    > Else
    > Me!TextBox2.enabled = True
    > Me!Textbox2.locked = False
    > End If
    >
    >
    > --
    > PC Datasheet
    > Your Resource For Help With Access, Excel And Word Applications
    > Over 1175 users have come to me from the newsgroups requesting help
    > resource@pcdatasheet.com
    >
    >
    >
    >
    > "default105" <default105@discussions.microsoft.com> wrote in message
    > news:7AA9CC4D-5919-465D-920B-B4070F95A399@microsoft.com...
    > > Is there an easy way to locked a records textboxes based on a value in one
    > > of
    > > the textbox fields.
    > >
    > > I have done this before but only ever had to protect 2 -5 fields from
    > > being
    > > accidently changed by creating a private sub that looked at a value in a
    > > field and changed the items to be locked properties if was true, then
    > > called
    > > that sub from the on current event. This probably is not the correct way
    > > and
    > > I way hoping someone could tell me how to do this better on a broader
    > > scale.
    > > I used before a option button to allow the users to edit the locked fields
    > > because sometime things may need to changed. I am using this as a
    > > "protect
    > > data" from accidently being changed.
    > >
    > > Thanks in advance.
    > >
    > > Pete

    >
    >
    >
     
  5. StopThisAdvertising

    StopThisAdvertising
    Expand Collapse
    Guest

    "PC Datasheet" <NoSpam@Spam.Com> schreef in bericht news:cxuag.3223$y4.1212@newsread2.news.pas.earthlink.net...

    --
    --
    > PC Datasheet
    > Your Resource For Help With Access, Excel And Word Applications 'Resource ????
    > Over 1175 users have come to me from the newsgroups requesting help '1175 users ????
    > resource@pcdatasheet.com


    --
    To Steve:
    No-one wants your advertising/job hunting here!
    Over 875 !! users from the newsgroups have visited the website to read what kind of a 'resource' you are... (rapidly increasing..)

    To the original poster:
    Most people here have a common belief that the newsgroups are for *free exchange of information*.
    But Steve is a notorious job hunter in these groups, always trying to sell his services.
    And he is known here as a shameless liar with no ethics at all.

    Before you intend to do business with him look at:
    http://home.tiscali.nl/arracom/whoissteve.html

    Arno R
     
  6. PC Datasheet

    PC Datasheet
    Expand Collapse
    Guest

    Name all your 20 textboxes so the name of each ends in a sequential number;
    ie TextBox1, TextBox2, TextBox3, .......

    Dim I as Integer
    For I = 1 to 20
    If Me!TextboxTest = X Then
    Me("TextBox" & I).enabled = False
    Me("TextBox" & I).locked = True
    Else
    Me("TextBox" & I).enabled = True
    Me("TextBox" & I).locked = False
    End If
    Next I

    This would even be better if you could count the number of textboxes and
    assign the ount to a variable to be used in the For statement rather than
    hardcoding 20.

    --
    PC Datasheet
    Your Resource For Help With Access, Excel And Word Applications
    Over 1175 users have come to me from the newsgroups requesting help
    resource@pcdatasheet.com





    "default105" <default105@discussions.microsoft.com> wrote in message
    news:BAE95034-A795-475F-91E1-DAAC8CB8B9A1@microsoft.com...
    > PC,
    > I realized that and that is the format I usually use. I was trying to
    > condense the question and as I did already today when trying to help out
    > someone else. Dumb on my part. I just was wondering if there was a
    > better
    > way to do this with multiple textboxes for example say 20 of them instead
    > of
    > code eating up 2 page heights.
    >
    > Thanks for the quick response
    >
    > "PC Datasheet" wrote:
    >
    >> You don't want to just lock the textbox, you want to disable it too.
    >>
    >> If Me!Textbox1 = X Then
    >> Me!TextBox2.enabled = False
    >> Me!Textbox2.locked = True
    >> Else
    >> Me!TextBox2.enabled = True
    >> Me!Textbox2.locked = False
    >> End If
    >>
    >>
    >> --
    >> PC Datasheet
    >> Your Resource For Help With Access, Excel And Word
    >> Applications
    >> Over 1175 users have come to me from the newsgroups requesting
    >> help
    >> resource@pcdatasheet.com
    >>
    >>
    >>
    >>
    >> "default105" <default105@discussions.microsoft.com> wrote in message
    >> news:7AA9CC4D-5919-465D-920B-B4070F95A399@microsoft.com...
    >> > Is there an easy way to locked a records textboxes based on a value in
    >> > one
    >> > of
    >> > the textbox fields.
    >> >
    >> > I have done this before but only ever had to protect 2 -5 fields from
    >> > being
    >> > accidently changed by creating a private sub that looked at a value in
    >> > a
    >> > field and changed the items to be locked properties if was true, then
    >> > called
    >> > that sub from the on current event. This probably is not the correct
    >> > way
    >> > and
    >> > I way hoping someone could tell me how to do this better on a broader
    >> > scale.
    >> > I used before a option button to allow the users to edit the locked
    >> > fields
    >> > because sometime things may need to changed. I am using this as a
    >> > "protect
    >> > data" from accidently being changed.
    >> >
    >> > Thanks in advance.
    >> >
    >> > Pete

    >>
    >>
    >>
     
  7. aaron.kempf@gmail.com

    aaron.kempf@gmail.com
    Expand Collapse
    Guest

    Arno

    screw you he wasn't even advertising!!!

    go to hell arno
     
  8. Arno R

    Arno R
    Expand Collapse
    Guest

    <aaron.kempf@gmail.com> schreef in bericht news:1147897363.903023.298590@j73g2000cwa.googlegroups.com...
    > Arno
    >
    > screw you he wasn't even advertising!!!
    >
    > go to hell arno


    Go to hell yourself, please ... ?
    It is obvious that you don't know what you the issue is here.

    Arno R
     
  9. Ron2006

    Ron2006
    Expand Collapse
    Guest

    how about this:

    Private Sub Form_Current()
    If Me.testfield = condtion Then
    Me.AllowEdits = False
    Else
    Me.AllowEdits = True
    End If

    End Sub

    Now all you have to do is figure out how to get the button to override
    the oncurrent event.
     
  10. aaron.kempf@gmail.com

    aaron.kempf@gmail.com
    Expand Collapse
    Guest

    arno

    i dont give a shit what the problem is; your needless whining about
    someone that is OBVIOUSLY trying to help is called BULLYING
     

Share This Page