default value by expression

  • Thread starter Thread starter Dave News
  • Start date Start date
D

Dave News

I have a form that has Location and MailAddress.
The Location field comes first and as I continue down my form I get to
MailAddress and I would like
to have the default value there to be what I just put in the Location field.
The record has not been
saved yet and everything I try here just gets me a blank field. I have tried
all sorts of help even one in
a macro / module but I am not sure what I am doing with the module provided
is implimented exactly
the way it should be?

I am stumped! Please help!
 
Try this

Right Click on the Location Field and select properties
Select the Events Tab
Double Click on the LostFocus event
[Event Procedure] should appear in the window
Click on the elipse (...) in the right margin to open the
code module
Type in:
If not isnull(me.MailAddress) then me.MailAddress =
me.Location
When you move off the Location field it checks to see if
there is a value in the Mailaddress field. If it is null
it will populate the field with the data in Location.
 
Thanks but it wouldn't work until I added to MailAddress DefaultValue
"me.[MailAddress] = me.[LOCATION]" Then it works like a charm.
When you enter start entering data into the form a 0 is placed in the field
MailAddress until you Got Focus. Then if you put anything in field
LOCATION it updates MailAddress and gives you the option to overwrite or
accept what is there. Now it works great thanks.


JohnR said:
Try this

Right Click on the Location Field and select properties
Select the Events Tab
Double Click on the LostFocus event
[Event Procedure] should appear in the window
Click on the elipse (...) in the right margin to open the
code module
Type in:
If not isnull(me.MailAddress) then me.MailAddress =
me.Location
When you move off the Location field it checks to see if
there is a value in the Mailaddress field. If it is null
it will populate the field with the data in Location.
-----Original Message-----
I have a form that has Location and MailAddress.
The Location field comes first and as I continue down my form I get to
MailAddress and I would like
to have the default value there to be what I just put in the Location field.
The record has not been
saved yet and everything I try here just gets me a blank field. I have tried
all sorts of help even one in
a macro / module but I am not sure what I am doing with the module provided
is implimented exactly
the way it should be?

I am stumped! Please help!


.
 
Back
Top