PC Review


Reply
Thread Tools Rate Thread

Default Button in a form

 
 
Alu_GK
Guest
Posts: n/a
 
      29th Sep 2009
Hey -
Access 2003, Vista.
I have fields in a form, that the default value was created in the table.
for the example the fields are 1-10 fiesld, and the default value for each
field is "OK".
I want the user to be able to change the default values of the fields from
the form itself.
something like a control that can be clicked and the value that in the
active field will be from now on the default value in the field.
thanks
--
Alu_GK
 
Reply With Quote
 
 
 
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      1st Oct 2009
Not really a security question, but easily answered.

Create a button or better still use the control's double-click event with
code similar to:


Private Sub txtMyTextbox_DblClick(Cancel As Integer)
Me.txtMyTextbox = Me.txtMyTextbox.DefaultValue
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Alu_GK" <(E-Mail Removed)> wrote in message
news:331B31C3-29D6-49E9-9586-(E-Mail Removed)...
> Hey -
> Access 2003, Vista.
> I have fields in a form, that the default value was created in the table.
> for the example the fields are 1-10 fiesld, and the default value for each
> field is "OK".
> I want the user to be able to change the default values of the fields from
> the form itself.
> something like a control that can be clicked and the value that in the
> active field will be from now on the default value in the field.
> thanks
> --
> Alu_GK



 
Reply With Quote
 
Alu_GK
Guest
Posts: n/a
 
      1st Oct 2009
You right, i didn't notice i was still in the security section.
I think i didn't explain my question well... so -
I want to create a botton that will change the default value to the value
that in the field in that moment.
Example: the default value is "OK" and the user needs to be able to change
the default value to "Fine" instead the "OK".
Thanks.
--
Alu_GK


"Arvin Meyer [MVP]" wrote:

> Not really a security question, but easily answered.
>
> Create a button or better still use the control's double-click event with
> code similar to:
>
>
> Private Sub txtMyTextbox_DblClick(Cancel As Integer)
> Me.txtMyTextbox = Me.txtMyTextbox.DefaultValue
> End Sub
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Alu_GK" <(E-Mail Removed)> wrote in message
> news:331B31C3-29D6-49E9-9586-(E-Mail Removed)...
> > Hey -
> > Access 2003, Vista.
> > I have fields in a form, that the default value was created in the table.
> > for the example the fields are 1-10 fiesld, and the default value for each
> > field is "OK".
> > I want the user to be able to change the default values of the fields from
> > the form itself.
> > something like a control that can be clicked and the value that in the
> > active field will be from now on the default value in the field.
> > thanks
> > --
> > Alu_GK

>
>
>

 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      2nd Oct 2009
Changing the default value in code, will only work while the form is open,
but you can do it like this:

Me.ControlName.DefaultValue = """" & Me.ControlName.Value & """"

That's 4 double quotes on either side. Use the AfterUpdate event of the
control for that code, and it should work while the form is open.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Alu_GK" <(E-Mail Removed)> wrote in message
news:00FDABB0-0BA3-4A8D-B985-(E-Mail Removed)...
> You right, i didn't notice i was still in the security section.
> I think i didn't explain my question well... so -
> I want to create a botton that will change the default value to the value
> that in the field in that moment.
> Example: the default value is "OK" and the user needs to be able to change
> the default value to "Fine" instead the "OK".
> Thanks.
> --
> Alu_GK
>
>
> "Arvin Meyer [MVP]" wrote:
>
>> Not really a security question, but easily answered.
>>
>> Create a button or better still use the control's double-click event with
>> code similar to:
>>
>>
>> Private Sub txtMyTextbox_DblClick(Cancel As Integer)
>> Me.txtMyTextbox = Me.txtMyTextbox.DefaultValue
>> End Sub
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>>
>> "Alu_GK" <(E-Mail Removed)> wrote in message
>> news:331B31C3-29D6-49E9-9586-(E-Mail Removed)...
>> > Hey -
>> > Access 2003, Vista.
>> > I have fields in a form, that the default value was created in the
>> > table.
>> > for the example the fields are 1-10 fiesld, and the default value for
>> > each
>> > field is "OK".
>> > I want the user to be able to change the default values of the fields
>> > from
>> > the form itself.
>> > something like a control that can be clicked and the value that in the
>> > active field will be from now on the default value in the field.
>> > thanks
>> > --
>> > Alu_GK

>>
>>
>>



 
Reply With Quote
 
Alu_GK
Guest
Posts: n/a
 
      8th Oct 2009
I tried to do this code, but it is not working.
I change it, and when I close the form and re-open a new record the default
value is not the new default value that I updated.
The form is open, while i update the default.
The default value define in the form (not in the table).

--
Alu_GK


"Arvin Meyer [MVP]" wrote:

> Changing the default value in code, will only work while the form is open,
> but you can do it like this:
>
> Me.ControlName.DefaultValue = """" & Me.ControlName.Value & """"
>
> That's 4 double quotes on either side. Use the AfterUpdate event of the
> control for that code, and it should work while the form is open.
> --
> Arvin Meyer, MCP, MVP
> http://www.datastrat.com
> http://www.mvps.org/access
> http://www.accessmvp.com
>
>
> "Alu_GK" <(E-Mail Removed)> wrote in message
> news:00FDABB0-0BA3-4A8D-B985-(E-Mail Removed)...
> > You right, i didn't notice i was still in the security section.
> > I think i didn't explain my question well... so -
> > I want to create a botton that will change the default value to the value
> > that in the field in that moment.
> > Example: the default value is "OK" and the user needs to be able to change
> > the default value to "Fine" instead the "OK".
> > Thanks.
> > --
> > Alu_GK
> >
> >
> > "Arvin Meyer [MVP]" wrote:
> >
> >> Not really a security question, but easily answered.
> >>
> >> Create a button or better still use the control's double-click event with
> >> code similar to:
> >>
> >>
> >> Private Sub txtMyTextbox_DblClick(Cancel As Integer)
> >> Me.txtMyTextbox = Me.txtMyTextbox.DefaultValue
> >> End Sub
> >> --
> >> Arvin Meyer, MCP, MVP
> >> http://www.datastrat.com
> >> http://www.mvps.org/access
> >> http://www.accessmvp.com
> >>
> >>
> >> "Alu_GK" <(E-Mail Removed)> wrote in message
> >> news:331B31C3-29D6-49E9-9586-(E-Mail Removed)...
> >> > Hey -
> >> > Access 2003, Vista.
> >> > I have fields in a form, that the default value was created in the
> >> > table.
> >> > for the example the fields are 1-10 fiesld, and the default value for
> >> > each
> >> > field is "OK".
> >> > I want the user to be able to change the default values of the fields
> >> > from
> >> > the form itself.
> >> > something like a control that can be clicked and the value that in the
> >> > active field will be from now on the default value in the field.
> >> > thanks
> >> > --
> >> > Alu_GK
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      9th Oct 2009
The code only works for the current session. If you close the form, that
session is over and you must add 1 record before the code works again.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


"Alu_GK" <(E-Mail Removed)> wrote in message
news:0BBA463F-C6CE-4B9F-8FFF-(E-Mail Removed)...
>I tried to do this code, but it is not working.
> I change it, and when I close the form and re-open a new record the
> default
> value is not the new default value that I updated.
> The form is open, while i update the default.
> The default value define in the form (not in the table).
>
> --
> Alu_GK
>
>
> "Arvin Meyer [MVP]" wrote:
>
>> Changing the default value in code, will only work while the form is
>> open,
>> but you can do it like this:
>>
>> Me.ControlName.DefaultValue = """" & Me.ControlName.Value & """"
>>
>> That's 4 double quotes on either side. Use the AfterUpdate event of the
>> control for that code, and it should work while the form is open.
>> --
>> Arvin Meyer, MCP, MVP
>> http://www.datastrat.com
>> http://www.mvps.org/access
>> http://www.accessmvp.com
>>
>>
>> "Alu_GK" <(E-Mail Removed)> wrote in message
>> news:00FDABB0-0BA3-4A8D-B985-(E-Mail Removed)...
>> > You right, i didn't notice i was still in the security section.
>> > I think i didn't explain my question well... so -
>> > I want to create a botton that will change the default value to the
>> > value
>> > that in the field in that moment.
>> > Example: the default value is "OK" and the user needs to be able to
>> > change
>> > the default value to "Fine" instead the "OK".
>> > Thanks.
>> > --
>> > Alu_GK
>> >
>> >
>> > "Arvin Meyer [MVP]" wrote:
>> >
>> >> Not really a security question, but easily answered.
>> >>
>> >> Create a button or better still use the control's double-click event
>> >> with
>> >> code similar to:
>> >>
>> >>
>> >> Private Sub txtMyTextbox_DblClick(Cancel As Integer)
>> >> Me.txtMyTextbox = Me.txtMyTextbox.DefaultValue
>> >> End Sub
>> >> --
>> >> Arvin Meyer, MCP, MVP
>> >> http://www.datastrat.com
>> >> http://www.mvps.org/access
>> >> http://www.accessmvp.com
>> >>
>> >>
>> >> "Alu_GK" <(E-Mail Removed)> wrote in message
>> >> news:331B31C3-29D6-49E9-9586-(E-Mail Removed)...
>> >> > Hey -
>> >> > Access 2003, Vista.
>> >> > I have fields in a form, that the default value was created in the
>> >> > table.
>> >> > for the example the fields are 1-10 fiesld, and the default value
>> >> > for
>> >> > each
>> >> > field is "OK".
>> >> > I want the user to be able to change the default values of the
>> >> > fields
>> >> > from
>> >> > the form itself.
>> >> > something like a control that can be clicked and the value that in
>> >> > the
>> >> > active field will be from now on the default value in the field.
>> >> > thanks
>> >> > --
>> >> > Alu_GK
>> >>
>> >>
>> >>

>>
>>
>>



 
Reply With Quote
 
Arvin Meyer [MVP]
Guest
Posts: n/a
 
      9th Oct 2009
"Salad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Alu_GK wrote:
>> I tried to do this code, but it is not working.
>> I change it, and when I close the form and re-open a new record the
>> default value is not the new default value that I updated.
>> The form is open, while i update the default. The default value define in
>> the form (not in the table).
>>

> You can test this out. When you close a form you can use acSaveYes. Maybe
> that will work. Docmd.close acform, Me.name, acsaveyes.


That will not work either. Only changes made to a form in design mode and
saved, will "stick"
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default button on a cf form =?Utf-8?B?UGF1bGE=?= Microsoft Dot NET Compact Framework 2 5th Jul 2005 07:05 PM
Default Button on web form Geoff Microsoft ASP .NET 0 25th Jun 2004 10:49 PM
default button on form Bratislav Jevtic Microsoft ASP .NET 2 17th Oct 2003 06:21 PM
Re: Set button as default on web form Steve C. Orr, MCSD Microsoft ASP .NET 0 14th Jul 2003 10:03 PM
Re: Set button as default on web form Patrick Steele [MVP] Microsoft ASP .NET 0 14th Jul 2003 08:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:54 AM.