Repeat field value

  • Thread starter Thread starter sharontodd
  • Start date Start date
S

sharontodd

Try # three to post this.

This should be super easy but I can't find it in here or in help.

I have a form that accepts info for screen printing orders. Fields include
item (shirt, short, hoodie), color, size, etc. After the user enters the
first record, I would like item and color to automatically be entered in each
new record with the option of the user being able to change it since this
will most often just repeat.

Thanks
 
Sharon, you have received answers from several knowledgeable people.

Do you now like those answers? Or you don't understand them?
 
Sharontodd -

On the BeforeUpdate event, you can set the default values for the form
controls that you want to keep the same for new records, setting them to the
current values, something like this:

Me.YourFormControl.DefaultValue = Me.YourFormControl.Value
Me.YourFormControl.DefaultValue = "'" & Me.YourFormControl.Value & "'"
Me.YourFormControl.DefaultValue = "#" & Me.YourFormControl.Value & "#"

Note you need text and date/time delimeters for those types of fields.
Setting the DefaultValue will affect any new records being added.
 
Actually, the DefaultValue property is text (regardless of the data type of
the field that's bound to the text box), so it's always appropriate to use

Me.YourFormControl.DefaultValue = "'" & Me.YourFormControl.Value & "'"

or

Me.YourFormControl.DefaultValue = """" & Me.YourFormControl.Value & """"

(to those who can't see the difference between those two statements, the
first one is using double quote-single quote-double quote (" ' "), while the
second is using four double quotes in a row (" " " ")
 
Back
Top