Setting default value of control on form to the value of another c

M

Marg

I am trying to set the default value of a control named DelAddr1 to the value
of another control on hte same form called CustAddr1. The form is called
Invoices. I've tried setting the dfault value of DelAddr1 to:

=[CustAddr1]
=![Invoices]![CustAddr1]
CustAddr1 has a tab stop number lower than DelAddr1
 
A

Al Campagna

Marg,
Not sure why you're doing that, but... using the
AfterUpdate event of CustAddr1 ....

Private Sub CustAddr1_AfterUpdate()
DelAddr1.DefaultValue = " ' " & [CustAddr1] & " ' "
End Sub
(I put spaces between the quotes for clarity... remove them in the final
code)
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
A

Allen Browne

The timing won't allow you to do it this way: Access applies the Default
Value as soon as you move to the new record. At that stage, you have not
entered the value of CustAddr1, so it cannot assign that value to DelAddr1.

Use the AfterUpdate event procedure of CustAddr1 to programmatically assign
the value to DelAddr1 also. The code for the event procedure will look like
this:

Private Sub CustAddr1_AfterUpdate()
Me.DelAddr1 = Me.CustAddr1
End Sub
 

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