Access 2000
This is a discussion about Access 2000 in the Windows Software category; Hello all, Well, I have a project I need to do in Access2000 (why access 2000 and not 2003? corporate have not upg yet). I will be heading to Barnes and Noble later today but here's what I have. I just created a form with rows setup.
Hello all,
Well, I have a project I need to do in Access2000 (why access 2000 and not 2003? corporate have not upg yet). I will be heading to Barnes and Noble later today but here's what I have. I just created a form with rows setup. RowA,B,C, and Total. User will enter numeric data in A,B,C. What I like to to do is on LostFocus (when a user tab away from either a,B, or C) the Total row will automatically sum up the current total. If this require VB script can you give sample please...thanks
Well, I have a project I need to do in Access2000 (why access 2000 and not 2003? corporate have not upg yet). I will be heading to Barnes and Noble later today but here's what I have. I just created a form with rows setup. RowA,B,C, and Total. User will enter numeric data in A,B,C. What I like to to do is on LostFocus (when a user tab away from either a,B, or C) the Total row will automatically sum up the current total. If this require VB script can you give sample please...thanks
Participate in our website and join the conversation
This subject has been archived. New comments and votes cannot be submitted.
Oct 17
Oct 21
0
2 minutes
Responses to this topic
I would simply do this:
Set each txt box to be numeric only through the properties. Then do the following code where text0/1/2 are the boxes that accept user input and text3 is the total box.
Option Compare Database
Option Explicit
Private Sub Text0_afterupdate()
Me.Text3 = Me.Text0 + Me.Text1 + Me.Text2
End Sub
Private Sub Text1_afterupdate()
Me.Text3 = Me.Text0 + Me.Text1 + Me.Text2
End Sub
Private Sub Text2_afterupdate()
Me.Text3 = Me.Text0 + Me.Text1 + Me.Text2
End Sub
This way, not matter which field has a value or no value it will add it up.
You can then add error trapping "IF" statements and msgbox's to alert the user to their stupidity. If you've set the boxes to numeric only, they will only accept numbers. It depends on what range of numbers you are expecting. With no error trapping, the boxes will accept any number, small or large.
Set each txt box to be numeric only through the properties. Then do the following code where text0/1/2 are the boxes that accept user input and text3 is the total box.
Option Compare Database
Option Explicit
Private Sub Text0_afterupdate()
Me.Text3 = Me.Text0 + Me.Text1 + Me.Text2
End Sub
Private Sub Text1_afterupdate()
Me.Text3 = Me.Text0 + Me.Text1 + Me.Text2
End Sub
Private Sub Text2_afterupdate()
Me.Text3 = Me.Text0 + Me.Text1 + Me.Text2
End Sub
This way, not matter which field has a value or no value it will add it up.
You can then add error trapping "IF" statements and msgbox's to alert the user to their stupidity. If you've set the boxes to numeric only, they will only accept numbers. It depends on what range of numbers you are expecting. With no error trapping, the boxes will accept any number, small or large.
Originally posted by Alec§taar:
Quote:NOTE - FELIX!!! "Shame on you man" - you didn't check to see if the field was blank/null!!!As far as I'm aware, if the field type is set to "number", the field values default to 0 not to NULL, so you shouldn't need check for NULL fields.
Rgds
AndyF
Quote:NOTE - FELIX!!! "Shame on you man" - you didn't check to see if the field was blank/null!!!As far as I'm aware, if the field type is set to "number", the field values default to 0 not to NULL, so you shouldn't need check for NULL fields.
Rgds
AndyF
AndyFair,
You are correct in so much as that when a new record in a table is created the values in a numeric field are set to "0" however on a form where the text field is unbound, the fields will remain NULL unless a value is entered by the user or the default value is set in the field properties.
If the field is bound to a field in the table, obviously it will display the value from the table, which unless changed, defaults to "0".
F
You are correct in so much as that when a new record in a table is created the values in a numeric field are set to "0" however on a form where the text field is unbound, the fields will remain NULL unless a value is entered by the user or the default value is set in the field properties.
If the field is bound to a field in the table, obviously it will display the value from the table, which unless changed, defaults to "0".
F