Defaulting an entry

J

John Calder

Hi

I use Win2K and Access 2K. I am completly new to access so please bear with
me. I would like to be able to have an entry in a form retained in each new
record.

That is to say, if I enter a persons name in a record ie John Smith, then
that entry would be retained in the next record thus saving me the trouble of
having to pick from a list for each new record. Then, if I change the name to
someone else ie Karen Phelps then that name would be retained in the next
record.

Any help would be much appreciated.

John
 
W

Wayne Morgan

Set the Default Value of the control in the form's BeforeUpdate event. This
way, the new default value will be there when you get to a new record and
will be filled in automatically. Do this for each control you want to
"copy".

Example:
Me.txtMyTextbox.DefautValue = Me.txtMyTextbox.Value

This will be "forgotten" when the form is closed, so the first new record
you create after opening the form will be from scratch.
 
J

John Calder

Thanks for you quick response Wayne. As I am a absolute new access user I
have failed to understand totally your reply. I had no trouble locating the
"BeforeUpdate" but I didnt really understand the Example:

Me.txtMyTextbox.DefautValue = Me.txtMyTextbox.Value

I tried typing the above text in but it didnt work? Obviously it is
something I am doing wrong.

Can You Help

Thanks
 
J

John Vinson

Thanks for you quick response Wayne. As I am a absolute new access user I
have failed to understand totally your reply. I had no trouble locating the
"BeforeUpdate" but I didnt really understand the Example:

Me.txtMyTextbox.DefautValue = Me.txtMyTextbox.Value

I tried typing the above text in but it didnt work? Obviously it is
something I am doing wrong.

Click on the ... icon by the property. Select the option "Code
Builder" from the list. Access will give you a Sub and End Sub line
for free - just copy the expression above in between them, with the
minor correction that it's DefaultValue rather than DefautValue.

John W. Vinson[MVP]
 
W

Wayne Morgan

John,

John Vinson caught my spelling error. In addition to his instructions,
you'll need to change the name of the control(s) to match the name or your
control(s) (i.e. change txtMyTextbox to the actual name of your textbox).
 
Top