Default Button in a form

A

Alu_GK

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
 
A

Arvin Meyer [MVP]

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
 
A

Alu_GK

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

Alu_GK

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).
 
A

Arvin Meyer [MVP]

Salad said:
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"
 

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