
January 23rd, 2004, 04:53 PM
|
|
Junior Member
|
|
Join Date: Jan 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Problem with rs.update I think
I'm having some trouble with VB in Access 2000. I have a form that the user enters in just one number (in this case, it's a base salary) and then the program is going to do a bunch of math (which is not all shown) and populate a table with these new, calculated salary values. I know I shouldn't be storing calculated values in the table, but I have to have these numbers in there as a lookup too.
Anyway I think I might be getting too complex with this, but any
assistance anyone can give me (or pointers to make it simpler if
possible) would be greatly appreciated.
It errors out at the rs.Update line and I cannot figure out why. The code is below.
* Edit: Please enclose code within the appropriate code tags.
Code:
Private Sub Populate_Click()
' populate the salary schedule columns
Dim rs As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Dim rs3 As ADODB.Recordset
'Dim SQL_query As String
Dim Counter As Integer
Dim BaseSalary As Long
Dim Index As Currency
Dim Salary As Long
'Dim yearsexp As Integer
Dim Updated As Boolean
Set rs = New ADODB.Recordset
Set rs2 = New ADODB.Recordset
Set rs3 = New ADODB.Recordset
Counter = 0
Index = 0
'open the recordset to get all the salary values
rs.Open ("SELECT * FROM salaryschedule"), CurrentProject.Connection
rs2.Open ("SELECT * FROM contractbase"), CurrentProject.Connection
rs3.Open ("SELECT * FROM indexes"), CurrentProject.Connection
rs.MoveFirst
rs2.MoveFirst
rs3.MoveFirst
'loop with counter based on year of experience and perform calculations of each salary amount based on year and index pulled from DB
Do Until Counter = 21
BaseSalary = rs2.Fields("Basesalary")
Index = rs3.Fields("bachelorsindex")
Salary = (BaseSalary * Index)
'Updated = rs.Update("400", Salary)
Updated = rs.Update("400", Salary) 'it errors out here constantly with "expected function or variable error"
Counter = Counter + 1
rs.MoveNext
rs3.MoveNext
Loop
Am I doing or overlooking something really stupid? Thanks! -Joe
|