Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 23rd, 2004, 04:53 PM
jcmarko jcmarko is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 1 jcmarko User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Problem with rs.update I think


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT