Need some help

I am new to this so please understand.  What I am trying to do is have 10 text boxes and those text boxes have a database field.  I want to enter a number for each box once the 10th box is entered I want to have it start back on the 1st box but not get rid of the other 9 boxes with the numbers in them.  I can replace the 1st box.  I'm trying to get an avg. over a 10 week period of how many hours a person works and I would put there hours in each week.  I hope this makes sense.
discgolfamAsked:
Who is Participating?
 
MattiConnect With a Mentor Commented:
Hi!

If I get this right you are doing
a front end to DB and need to addnew
record when user fils it and press Enter in the last field?

Private Sub Text10_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Data1.Recordset.AddNew
DoEvents
Text10.Text = ""
Text9.Text = ""
Text8.Text = ""
Text7.Text = ""
Text6.Text = ""
Text5.Text = ""
Text4.Text = ""
Text3.Text = ""
Text2.Text = ""
Text1.Text = ""
Text1.SetFocus
End If
End Sub


If you need to auto insert someting if must be done like text = "string here"

I also asyme you did bind those textboxes using a datacontrol, correct?

That binding might create update problem
if you set some text boxes by code, it need to handle, this sample ADDNEW first
then touches to text values.

Also much better performance and programming style is use here a loop, but you must use a control array whit those textboxes first, might need just renane them.

Dim i&
For i = 0 to 9
textbox(i).text = ""
Next i
 
Matti
0
 
GeorgeKCommented:
Sorry,
  Your discription is a little difficult to follow. Are your text boxes bound to fields in the database? What data is it that your storing in the text boxes? Hours? Why do you mean by start back on the 1st box but not get rid of the other boxes? do you want to display the tenth record into the 1st text box? How do you know whose hours the text boxes relate to when entering the hours or are you just summing hours and adding the separate hour values to the database?
0
 
discgolfamAuthor Commented:
Sorry about how difficult it is to follow.  Yes the text boxes are bound to fields in the database.  I just want to store numbers, which are the employees hours for the week.  I don't want to keep track of more than 10 weeks worth of hours.  I need to get an avg. of how many hours the employee works over a 10 week period.  These hours are entered by hand each week.  I hope this helps.
0
All Courses

From novice to tech pro — start learning today.