A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old July 2nd, 2009, 01:42 PM posted to microsoft.public.access
Marg
external usenet poster
 
Posts: 30
Default Setting default value of control on form to the value of another c

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

--
Marg
  #2  
Old July 2nd, 2009, 03:07 PM posted to microsoft.public.access
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Setting default value of control on form to the value of another c

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

"Marg" wrote in message
...
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

--
Marg



  #3  
Old July 2nd, 2009, 03:08 PM posted to microsoft.public.access
Allen Browne
external usenet poster
 
Posts: 11,706
Default Setting default value of control on form to the value of another c

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

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Marg" wrote in message
...
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

--
Marg


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:10 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.