Code for formula vs manual entry

  • Thread starter Lori2836 via AccessMonster.com
  • Start date
L

Lori2836 via AccessMonster.com

Good morning. Can someone help. I need to write code in a form where if
column 'A' is blank then allow manual entry into column 'C', else column 'A'
* 94.45. I'm not sure how to do this or if it can be done.

Thanks!
 
S

Stefan Hoffmann

hi Lori,
Good morning. Can someone help. I need to write code in a form where if
column 'A' is blank then allow manual entry into column 'C', else column 'A'
* 94.45. I'm not sure how to do this or if it can be done.
This needs some coding, place the following code into the On Change
events of the TextBoxes:

Private Sub txtA_Change()

If IsNumeric(txtA.Value) Then
txtC.Value = CDbl(txtA.Value) * 94.45
End If

End Sub


Private Sub txtC_Change()

txtA.Value = Null

End Sub


mfG
--> stefan <--
 
L

Lori2836 via AccessMonster.com

Thanks Stefan....but for some reason it doesn't work. When I type a number
into column 'A', nothing happens in column 'C'....it doesn't multiply by 94.
45.........
 
S

Stefan Hoffmann

hi Lori,
Thanks Stefan....but for some reason it doesn't work. When I type a number
into column 'A', nothing happens in column 'C'....it doesn't multiply by 94.
45.........
My fault. You have to use txtA.Text in the change event as txtA.Value
only reflects the stored value.


mfG
--> stefan <--
 
L

Lori2836 via AccessMonster.com

Stefan - good morning. This still isn't working and not sure if I'm just
miscoding something. Here is what I have:

Private Sub Text496_Change()

If IsNumeric(Text496.Text) Then
Text530.Text = CDbl(Text496.Text) * 94.45
End If

End Sub

Private Sub Text530_Change()

Text496.Text = Null

End Sub

The debugger keeps highlighting "Text530.Text = CDbl(Text496.Text) * 94.45"
 
S

Stefan Hoffmann

hi Lori,
Stefan - good morning.
Thanks, but as i'm living and working in Bavaria: it's already afternoon
here :)
The debugger keeps highlighting "Text530.Text = CDbl(Text496.Text) * 94.45"
You only have to use .Text for reading the _changing_ value. It must be:

Text530.Value = CDbl(Text496.Text) * 94.45

mfG
--> stefan <--
 
L

Lori2836 via AccessMonster.com

Wow.....Bavaria, huh? Well then, good afternoon! Anyways, it worked!
And I thank you so very much for your help. We, who are not masters of
Access, are so appreciative of those who are!

Lori
 
Top