Repeat field value

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
 
A

Allen Browne

Sharon, you have received answers from several knowledgeable people.

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

Daryl S

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

Douglas J. Steele

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 (" " " ")
 

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