Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: VBA vs SQL to assign a default value


Message #1 by "Tammy Tappan" <GRTappan@e...> on Thu, 29 Nov 2001 16:40:38
I have a form that lists a person's demographic info. It's Record Source 

is a table that has a field called Extension - hold the 4-digit extension 

of the employee.



On the form, I want to have a field that displays the extension in the 

format of the entire phone number (123) 555- [the 4 digit extension].



I've tried every way I can think of using default values, & building a 

statement in that way - nothing works.



Help!



+Tammy
Message #2 by brian.skelton@b... on Thu, 29 Nov 2001 16:57:12
Tammy



Try putting "(123) 555-"; in the Format property of the control you're 

using to display the phone number.



-Brian



> I have a form that lists a person's demographic info. It's Record Source 

> is a table that has a field called Extension - hold the 4-digit 

extension 

> of the employee.

> 

> On the form, I want to have a field that displays the extension in the 

> format of the entire phone number (123) 555- [the 4 digit extension].

> 

> I've tried every way I can think of using default values, & building a 

> statement in that way - nothing works.

> 

> Help!

> 

> +Tammy
Message #3 by "Tammy Tappan" <GRTappan@e...> on Thu, 29 Nov 2001 17:13:05
That's the easy part! =)  The problem is getting it to pull in the 

existing extension info. This box will be locked from any input, because 

the requiered value will already be there, & I don't want there to be an 

option to change it.



+Tammy



> Tammy

> 

> Try putting "(123) 555-"; in the Format property of the control you're 

> using to display the phone number.

> 

> -Brian

> 

> > I have a form that lists a person's demographic info. It's Record 

Source 

> > is a table that has a field called Extension - hold the 4-digit 

> extension 

> > of the employee.

> > 

> > On the form, I want to have a field that displays the extension in the 

> > format of the entire phone number (123) 555- [the 4 digit extension].

> > 

> > I've tried every way I can think of using default values, & building a 

> > statement in that way - nothing works.

> > 

> > Help!

> > 

> > +Tammy
Message #4 by "John Ruff" <papparuff@c...> on Thu, 29 Nov 2001 10:05:32 -0800
Tammy,



There are a couple of ways to do this.  If the recordsource for the form

is a query, you can say PhoneNo:"(123) 555-" & [the 4 digit extension].

Then the control's Control Source would be PhoneNo.



Or



You can place a textbox on the for (txtPhone for clarity) and then:



Textbox name: txtPhone

Control Source: ="(123) 555-" & [the 4 digit extension]

Enabled: No

Locked: Yes



John Ruff - The Eternal Optimist :-)







-----Original Message-----

From: brian.skelton@b...

[mailto:brian.skelton@b...] 

Sent: Thursday, November 29, 2001 4:57 PM

To: Access

Subject: [access] Re: VBA vs SQL to assign a default value





Tammy



Try putting "(123) 555-"; in the Format property of the control you're 

using to display the phone number.



-Brian



> I have a form that lists a person's demographic info. It's Record 

> Source

> is a table that has a field called Extension - hold the 4-digit 

extension 

> of the employee.

> 

> On the form, I want to have a field that displays the extension in the

> format of the entire phone number (123) 555- [the 4 digit extension].

> 

> I've tried every way I can think of using default values, & building a

> statement in that way - nothing works.

> 

> Help!

> 

> +Tammy

---

You are currently subscribed to access as: papparuff@c... To

unsubscribe send a blank email to $subst('Email.Unsub')



Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&catego

ryid=rn_ebooks







Message #5 by "Tammy Tappan" <GRTappan@e...> on Thu, 29 Nov 2001 18:38:32
The form is based on a table, & it's pulling in the correct info from the 

table (so it appears! Although, it may just be displaying the name & SSN 

based on the command to pull that info from the previous form!).



I have the textbox in, & when I put that command for the Control Source 

all that shows in the (123) 555-



The table field is called Extension, so I put [Extension] after the & in 

the control source command; did I miss something?



+Tammy



> Tammy,

> 

> There are a couple of ways to do this.  If the recordsource for the form

> is a query, you can say PhoneNo:"(123) 555-" & [the 4 digit extension].

> Then the control's Control Source would be PhoneNo.

> 

> Or

> 

> You can place a textbox on the for (txtPhone for clarity) and then:

> 

> Textbox name: txtPhone

> Control Source: ="(123) 555-" & [the 4 digit extension]

> Enabled: No

> Locked: Yes

> 

> John Ruff - The Eternal Optimist :-)
Message #6 by "John Ruff" <papparuff@c...> on Thu, 29 Nov 2001 10:43:03 -0800
Ok,



Do not name the textbox Extension as it will try to pull the data from

the Extension field.  Instead;



 Textbox name: txtExtension

 Control Source: ="(123) 555-" & [the 4 digit extension]

 Enabled: No

 Locked: Yes



John Ruff - The Eternal Optimist :-)







-----Original Message-----

From: Tammy Tappan [mailto:GRTappan@e...] 

Sent: Thursday, November 29, 2001 6:39 PM

To: Access

Subject: [access] Re: VBA vs SQL to assign a default value





The form is based on a table, & it's pulling in the correct info from

the 

table (so it appears! Although, it may just be displaying the name & SSN



based on the command to pull that info from the previous form!).



I have the textbox in, & when I put that command for the Control Source 

all that shows in the (123) 555-



The table field is called Extension, so I put [Extension] after the & in



the control source command; did I miss something?



+Tammy



> Tammy,

> 

> There are a couple of ways to do this.  If the recordsource for the 

> form is a query, you can say PhoneNo:"(123) 555-" & [the 4 digit 

> extension]. Then the control's Control Source would be PhoneNo.

> 

> Or

> 

> You can place a textbox on the for (txtPhone for clarity) and then:

> 

> Textbox name: txtPhone

> Control Source: ="(123) 555-" & [the 4 digit extension]

> Enabled: No

> Locked: Yes

> 

> John Ruff - The Eternal Optimist :-)

---

You are currently subscribed to access as: papparuff@c... To

unsubscribe send a blank email to $subst('Email.Unsub')



Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&catego

ryid=rn_ebooks







Message #7 by "Tammy Tappan" <GRTappan@e...> on Thu, 29 Nov 2001 20:29:50
I didn't - the text box is called txtUsersPhone.



??



+Tammy





> Ok,

> 

> Do not name the textbox Extension as it will try to pull the data from

> the Extension field.  Instead;

> 

>  Textbox name: txtExtension

>  Control Source: ="(123) 555-" & [the 4 digit extension]

>  Enabled: No

>  Locked: Yes

> 

> John Ruff - The Eternal Optimist :-)

> 

> 

Message #8 by "John Ruff" <papparuff@c...> on Thu, 29 Nov 2001 12:45:50 -0800
Ok Tammy,



Then set the Control Source, Enabled, and Locked to what I've indicated

below.





Textbox name: txtUsersPhone

Control Source: ="(123) 555-" & [the 4 digit extension]

Enabled: No

Locked: Yes



John Ruff - The Eternal Optimist :-)







-----Original Message-----

From: Tammy Tappan [mailto:GRTappan@e...] 

Sent: Thursday, November 29, 2001 8:30 PM

To: Access

Subject: [access] Re: VBA vs SQL to assign a default value





I didn't - the text box is called txtUsersPhone.



??



+Tammy





> Ok,

> 

> Do not name the textbox Extension as it will try to pull the data from



> the Extension field.  Instead;

> 

>  Textbox name: txtExtension

>  Control Source: ="(123) 555-" & [the 4 digit extension]

>  Enabled: No

>  Locked: Yes

> 

> John Ruff - The Eternal Optimist :-)

> 

> 



---

You are currently subscribed to access as: papparuff@c... To

unsubscribe send a blank email to $subst('Email.Unsub')



Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&catego

ryid=rn_ebooks







Message #9 by "Tammy Tappan" <GRTappan@e...> on Thu, 29 Nov 2001 21:33:13
Did that except the info inside the [ ] for me is [Extension], which is 

the field name I'm pulling from.



Textbox name: txtUsersPhone

Control Source: ="(123) 555-" & [Extension]

Enabled: No

Locked: Yes



Do you think the form isn't linking to the table?



+Tammy



> Ok Tammy,

> 

> Then set the Control Source, Enabled, and Locked to what I've indicated

> below.

> 

> 

> Textbox name: txtUsersPhone

> Control Source: ="(123) 555-" & [the 4 digit extension]

> Enabled: No

> Locked: Yes

> 

> John Ruff - The Eternal Optimist :-)

> 


  Return to Index