Danielle17
Technical User
I have to add 5 columns of new info to an already existing record. I have 4 text boxes on a form each of which contain a dollar amount (Lodging, Meals, Gas, & Misc). Then I have another text box, Totals. I know that you can't calculate columns across and I also know that you can't do this in a table. So I've resorted to a form.
Now, on my form I have 4 text boxes one for each of the expense departments and another for the total. I'm not real good at using the expression builder so I'm unsure how to program the Totals text box to add the other 4 boxes. Before the user clicks the command button to add this new info they have to type in the JobID number in another text box. (I've never done anything like this before....)So that when the cmd btn is clicked the code will read something like, Go to record with this number (which is also the primary key), and add the info from the text boxes into the record that has that JobID.
I know how to say it in english, now I need a "computer person" to help me translate that into computer code
Here's what I have so far:
Private Sub cmdEnter_Click()
Dim db As Database
Dim rsExpense As Recordset
Set db = CurrentDb
Set rsExpense = db.OpenRecordset("zJobTable"
' put zeros in txt boxes so that it can be calculated if there is no number entered
If Me.txtLodging = "" Then
Me.txtLodging = 0
End If
If Me.txtMeals = "" Then
Me.txtMeals = 0
End If
If Me.txtGas = "" Then
Me.txtGas = 0
End If
If Me.txtMisc = "" Then
Me.txtMisc = 0
End If
rsExpense("LodgingCost" = Me.txtLodging
rsExpense("MealsCost" = Me.txtMeals
rsExpense("GasCost" = Me.txtGas
rsExpense("MiscCost" = Me.txtMisc
rsExpense("TotalCost" = Me.txtTotal
End Sub
I know it needs some help(right into the trash!) Thanks.
Now, on my form I have 4 text boxes one for each of the expense departments and another for the total. I'm not real good at using the expression builder so I'm unsure how to program the Totals text box to add the other 4 boxes. Before the user clicks the command button to add this new info they have to type in the JobID number in another text box. (I've never done anything like this before....)So that when the cmd btn is clicked the code will read something like, Go to record with this number (which is also the primary key), and add the info from the text boxes into the record that has that JobID.
I know how to say it in english, now I need a "computer person" to help me translate that into computer code
Here's what I have so far:
Private Sub cmdEnter_Click()
Dim db As Database
Dim rsExpense As Recordset
Set db = CurrentDb
Set rsExpense = db.OpenRecordset("zJobTable"
' put zeros in txt boxes so that it can be calculated if there is no number entered
If Me.txtLodging = "" Then
Me.txtLodging = 0
End If
If Me.txtMeals = "" Then
Me.txtMeals = 0
End If
If Me.txtGas = "" Then
Me.txtGas = 0
End If
If Me.txtMisc = "" Then
Me.txtMisc = 0
End If
rsExpense("LodgingCost" = Me.txtLodging
rsExpense("MealsCost" = Me.txtMeals
rsExpense("GasCost" = Me.txtGas
rsExpense("MiscCost" = Me.txtMisc
rsExpense("TotalCost" = Me.txtTotal
End Sub
I know it needs some help(right into the trash!) Thanks.