dbTalk Databases Forums  

Problem with rs.Update I think

comp.database.ms-access comp.database.ms-access


Discuss Problem with rs.Update I think in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Joseph Markovich
 
Posts: n/a

Default Problem with rs.Update I think - 01-21-2004 , 09:07 PM






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 bumch of math 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.

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
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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.