current value plus another one

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
there is a number(data type) field and another number field in a subform.
all i want is every time i type a number into the second field (the subform
field ), the first field to get updated , its current value plus that
number.is that possible?
 
try using the afterupdate event of the first field and add the following code

me.[Name of First Field] =me.[Name of Second Field] +me.[Name of First Field]

Daniel
 
well i tried that code but unfortunatly i didnt watch any action.
then i tried of me.[Name of First Field] =me.SubFormname.Form![Name of
Second Field] +me.[Name of First Field]
but still nothing.

if u think something else Daniel pls let me know.
Thanks
Daniel said:
try using the afterupdate event of the first field and add the following code

me.[Name of First Field] =me.[Name of Second Field] +me.[Name of First Field]

Daniel



bill said:
hi
there is a number(data type) field and another number field in a subform.
all i want is every time i type a number into the second field (the subform
field ), the first field to get updated , its current value plus that
number.is that possible?
 
1- It will only get triggered after you set the focus onto another field.

2- Depending on how everything is setup you may need to use a function such
as ...=clng(me.SubFormname.Form![Name of Second Field]) + clng(me.[Name of
First Field]) to ensure that they are processed numerically. For more info
check 'Type Conversion Functions' in the help menu.

Daniel






bill said:
well i tried that code but unfortunatly i didnt watch any action.
then i tried of me.[Name of First Field] =me.SubFormname.Form![Name of
Second Field] +me.[Name of First Field]
but still nothing.

if u think something else Daniel pls let me know.
Thanks
Daniel said:
try using the afterupdate event of the first field and add the following code

me.[Name of First Field] =me.[Name of Second Field] +me.[Name of First Field]

Daniel



bill said:
hi
there is a number(data type) field and another number field in a subform.
all i want is every time i type a number into the second field (the subform
field ), the first field to get updated , its current value plus that
number.is that possible?
 
Bill,

I made a small mockup to test. the form has 2 text boxes (txtValue1 &
txtValue2). Also, I ensured that both text boxes where set as 'General
Number' format mode in the properties. Then I coded the following

Private Sub txtValue1_AfterUpdate()
Me.txtValue1 = Me.txtValue1 + Me.txtValue2
End Sub

and it works fine. Whenever I make a change in value an move my mouse to
the second text box the first one's value is adjusted appropriately. Give it
a try a let me know if you are still having problems.

Daniel




Daniel said:
1- It will only get triggered after you set the focus onto another field.

2- Depending on how everything is setup you may need to use a function such
as ...=clng(me.SubFormname.Form![Name of Second Field]) + clng(me.[Name of
First Field]) to ensure that they are processed numerically. For more info
check 'Type Conversion Functions' in the help menu.

Daniel






bill said:
well i tried that code but unfortunatly i didnt watch any action.
then i tried of me.[Name of First Field] =me.SubFormname.Form![Name of
Second Field] +me.[Name of First Field]
but still nothing.

if u think something else Daniel pls let me know.
Thanks
Daniel said:
try using the afterupdate event of the first field and add the following code

me.[Name of First Field] =me.[Name of Second Field] +me.[Name of First Field]

Daniel



:

hi
there is a number(data type) field and another number field in a subform.
all i want is every time i type a number into the second field (the subform
field ), the first field to get updated , its current value plus that
number.is that possible?
 
hmm yes u have right its working fine...i forgot to tell you the most
important, the second textbox its a "function calculated" box calculating the
dateDif.
Do i have to store that value back to the table first and then write the
code u gave me?


Daniel said:
Bill,

I made a small mockup to test. the form has 2 text boxes (txtValue1 &
txtValue2). Also, I ensured that both text boxes where set as 'General
Number' format mode in the properties. Then I coded the following

Private Sub txtValue1_AfterUpdate()
Me.txtValue1 = Me.txtValue1 + Me.txtValue2
End Sub

and it works fine. Whenever I make a change in value an move my mouse to
the second text box the first one's value is adjusted appropriately. Give it
a try a let me know if you are still having problems.

Daniel




Daniel said:
1- It will only get triggered after you set the focus onto another field.

2- Depending on how everything is setup you may need to use a function such
as ...=clng(me.SubFormname.Form![Name of Second Field]) + clng(me.[Name of
First Field]) to ensure that they are processed numerically. For more info
check 'Type Conversion Functions' in the help menu.

Daniel






bill said:
well i tried that code but unfortunatly i didnt watch any action.
then i tried of me.[Name of First Field] =me.SubFormname.Form![Name of
Second Field] +me.[Name of First Field]
but still nothing.

if u think something else Daniel pls let me know.
Thanks
:

try using the afterupdate event of the first field and add the following code

me.[Name of First Field] =me.[Name of Second Field] +me.[Name of First Field]

Daniel



:

hi
there is a number(data type) field and another number field in a subform.
all i want is every time i type a number into the second field (the subform
field ), the first field to get updated , its current value plus that
number.is that possible?
 
Back
Top