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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Input into one field to generate a value in another



 
 
Thread Tools Display Modes
  #1  
Old October 4th, 2006, 11:27 AM posted to microsoft.public.access.forms
CW
external usenet poster
 
Posts: 701
Default Input into one field to generate a value in another

I have a costing form on which users will enter the description of crates to
be used, and the costs will be generated and totalled.
There are 10 lines and on some records there may be no crates, on others
there may be several.
There is a description field and then another field on each line that holds
the cost of the crate. This is a fixed amount of 60.00 for each crate that is
used.
I cannot use a default value of 60.00 as this would lead to a total of
600.00 on every record regardless of whether any crates had been specified or
not.
I want the value of 60.00 to appear automatically in the cost field on a
line ONLY if a user actually enters something in the description field on
that line.
It should not be triggered by the focus going into a description field, as a
user may well tab through all the lines as part of the page navigation.
I am assuming it needs a piece of code that will be kicked off On Change, or
something like that, in the Description field, and I have tried several
expressions but nothing worked!
I am sure this is quite simple and somebody will have the answer rightaway?
Many thanks
CW
  #2  
Old October 4th, 2006, 01:40 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default Input into one field to generate a value in another

CW,
Make the default Price 0.00
Use the AfdterUpdate event of Decription...
If Not IsNull(Description) Then
Price = 60
Else
Price = 0
End if

If the user might delete the Description, Price would go back to zero.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"CW" wrote in message
...
I have a costing form on which users will enter the description of crates to
be used, and the costs will be generated and totalled.
There are 10 lines and on some records there may be no crates, on others
there may be several.
There is a description field and then another field on each line that holds
the cost of the crate. This is a fixed amount of 60.00 for each crate that is
used.
I cannot use a default value of 60.00 as this would lead to a total of
600.00 on every record regardless of whether any crates had been specified or
not.
I want the value of 60.00 to appear automatically in the cost field on a
line ONLY if a user actually enters something in the description field on
that line.
It should not be triggered by the focus going into a description field, as a
user may well tab through all the lines as part of the page navigation.
I am assuming it needs a piece of code that will be kicked off On Change, or
something like that, in the Description field, and I have tried several
expressions but nothing worked!
I am sure this is quite simple and somebody will have the answer rightaway?
Many thanks
CW



  #3  
Old October 4th, 2006, 02:45 PM posted to microsoft.public.access.forms
CW
external usenet poster
 
Posts: 701
Default Input into one field to generate a value in another

Thanks, Al, but this didn't work (at all). No error msge, no effect at all.
Any other suggestions, please!

"Al Campagna" wrote:

CW,
Make the default Price 0.00
Use the AfdterUpdate event of Decription...
If Not IsNull(Description) Then
Price = 60
Else
Price = 0
End if

If the user might delete the Description, Price would go back to zero.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"CW" wrote in message
...
I have a costing form on which users will enter the description of crates to
be used, and the costs will be generated and totalled.
There are 10 lines and on some records there may be no crates, on others
there may be several.
There is a description field and then another field on each line that holds
the cost of the crate. This is a fixed amount of 60.00 for each crate that is
used.
I cannot use a default value of 60.00 as this would lead to a total of
600.00 on every record regardless of whether any crates had been specified or
not.
I want the value of 60.00 to appear automatically in the cost field on a
line ONLY if a user actually enters something in the description field on
that line.
It should not be triggered by the focus going into a description field, as a
user may well tab through all the lines as part of the page navigation.
I am assuming it needs a piece of code that will be kicked off On Change, or
something like that, in the Description field, and I have tried several
expressions but nothing worked!
I am sure this is quite simple and somebody will have the answer rightaway?
Many thanks
CW




  #4  
Old October 4th, 2006, 05:33 PM posted to microsoft.public.access.forms
Al Campagna
external usenet poster
 
Posts: 421
Default Input into one field to generate a value in another

CW,
I tested the code, and it works, if your setup is as you stated, and you installed the
code properly.

This code will not effect any previously entered data. It works as you fill in, or
delete, the Description.
Go to any record without a Description, and add one... the Price will update to 60.
If you already have many records with a default price and no Desc, and you want to put
in Price if there is a description, and no Price if not, then you'll have to run a "one
time" Update query against the previous records. (using the same logic as my IF)
After that, each record will take care of itself as is is added.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"CW" wrote in message
...
Thanks, Al, but this didn't work (at all). No error msge, no effect at all.
Any other suggestions, please!

"Al Campagna" wrote:

CW,
Make the default Price 0.00
Use the AfdterUpdate event of Decription...
If Not IsNull(Description) Then
Price = 60
Else
Price = 0
End if

If the user might delete the Description, Price would go back to zero.

--
hth
Al Campagna
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

"CW" wrote in message
...
I have a costing form on which users will enter the description of crates to
be used, and the costs will be generated and totalled.
There are 10 lines and on some records there may be no crates, on others
there may be several.
There is a description field and then another field on each line that holds
the cost of the crate. This is a fixed amount of 60.00 for each crate that is
used.
I cannot use a default value of 60.00 as this would lead to a total of
600.00 on every record regardless of whether any crates had been specified or
not.
I want the value of 60.00 to appear automatically in the cost field on a
line ONLY if a user actually enters something in the description field on
that line.
It should not be triggered by the focus going into a description field, as a
user may well tab through all the lines as part of the page navigation.
I am assuming it needs a piece of code that will be kicked off On Change, or
something like that, in the Description field, and I have tried several
expressions but nothing worked!
I am sure this is quite simple and somebody will have the answer rightaway?
Many thanks
CW






 




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:07 AM.


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