Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: drop down field

Geek News

drop down field
tracktraining 11/25/2008 5:27:01 PM
Hi All,

I was wondering if there is a way to code in VB if the drop down field is
selected to be "Terminated", then that field cannot be changed anymore. So,
once the user select "Terminated" from the drop down menu field, then a
message will appear asking if this is what they want, if yes, then
"Terminated" is selected and user is unable to change that field anymore.

Is this possible? any suggestions?

Thanks,
Tracktraining


--
Learning
RE: drop down field
Maurice 11/25/2008 6:25:01 PM
If you select the option you could go for the "locked" option. This ofcourse
would only apply for the actual form and situation. If you want it to stay
locked you have to add a initial check when the form load to check if the
value is "terminated".

So basically:


in the after update of the control you place

if me.combobox="terminated" then
me.combobox.locked =true
end if

if you have a table as a source you should test for the numerical value..
something like this

if me.combobox=1 then '- if that's the value for terminated
me.combobx.locked=true
end if

Now in the form load (or form open) you can place the check to see if the
value is set to 'terminated' much the same way. But that's only necessary if
you have the option to view all records.

hth


--
Maurice Ausum


"tracktraining" wrote:

[Quoted Text]
> Hi All,
>
> I was wondering if there is a way to code in VB if the drop down field is
> selected to be "Terminated", then that field cannot be changed anymore. So,
> once the user select "Terminated" from the drop down menu field, then a
> message will appear asking if this is what they want, if yes, then
> "Terminated" is selected and user is unable to change that field anymore.
>
> Is this possible? any suggestions?
>
> Thanks,
> Tracktraining
>
>
> --
> Learning
RE: drop down field
tracktraining 11/26/2008 12:49:01 AM
thanks!
--
Learning


"Maurice" wrote:

[Quoted Text]
> If you select the option you could go for the "locked" option. This ofcourse
> would only apply for the actual form and situation. If you want it to stay
> locked you have to add a initial check when the form load to check if the
> value is "terminated".
>
> So basically:
>
>
> in the after update of the control you place
>
> if me.combobox="terminated" then
> me.combobox.locked =true
> end if
>
> if you have a table as a source you should test for the numerical value..
> something like this
>
> if me.combobox=1 then '- if that's the value for terminated
> me.combobx.locked=true
> end if
>
> Now in the form load (or form open) you can place the check to see if the
> value is set to 'terminated' much the same way. But that's only necessary if
> you have the option to view all records.
>
> hth
>
>
> --
> Maurice Ausum
>
>
> "tracktraining" wrote:
>
> > Hi All,
> >
> > I was wondering if there is a way to code in VB if the drop down field is
> > selected to be "Terminated", then that field cannot be changed anymore. So,
> > once the user select "Terminated" from the drop down menu field, then a
> > message will appear asking if this is what they want, if yes, then
> > "Terminated" is selected and user is unable to change that field anymore.
> >
> > Is this possible? any suggestions?
> >
> > Thanks,
> > Tracktraining
> >
> >
> > --
> > Learning
Re: drop down field
"Dale Fye" <dale.fye[ at ]nospam.com> 11/26/2008 1:38:29 AM
Actually, I'd use the Forms Current event rather that Form_Open or
Form_Load.

Basically, you want this code to fire every time you move to a different
record, so that they cannot change the value. However, I would also change
the code you used because the way you did it, if you lock it then when you
go to another record, it will stay locked (because you never set it to
false). So here is what I would do:

Private Sub combobox_AfterUpdate

me.combobox.locked = (me.combobox = "Terminated")

End Sub

Private Sub Form_Current

me.combobox.locked = (me.combobox = "Terminated")

End Sub

Dale

"Maurice" <Maurice[ at ]discussions.microsoft.com> wrote in message
news:0D4B7759-8FAD-41F9-9A32-B341A014DAB8[ at ]microsoft.com...
[Quoted Text]
> If you select the option you could go for the "locked" option. This
> ofcourse
> would only apply for the actual form and situation. If you want it to stay
> locked you have to add a initial check when the form load to check if the
> value is "terminated".
>
> So basically:
>
>
> in the after update of the control you place
>
> if me.combobox="terminated" then
> me.combobox.locked =true
> end if
>
> if you have a table as a source you should test for the numerical value..
> something like this
>
> if me.combobox=1 then '- if that's the value for terminated
> me.combobx.locked=true
> end if
>
> Now in the form load (or form open) you can place the check to see if the
> value is set to 'terminated' much the same way. But that's only necessary
> if
> you have the option to view all records.
>
> hth
>
>
> --
> Maurice Ausum
>
>
> "tracktraining" wrote:
>
>> Hi All,
>>
>> I was wondering if there is a way to code in VB if the drop down field is
>> selected to be "Terminated", then that field cannot be changed anymore.
>> So,
>> once the user select "Terminated" from the drop down menu field, then a
>> message will appear asking if this is what they want, if yes, then
>> "Terminated" is selected and user is unable to change that field anymore.
>>
>> Is this possible? any suggestions?
>>
>> Thanks,
>> Tracktraining
>>
>>
>> --
>> Learning


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net