|
-
May 21st, 2003, 11:36 AM
#1
Thread Starter
Lively Member
Open Access Recordset
I know this is really basic, but it's driving me crazy...
I am trying to open a recordset, and based on the data in
one field, save a value in another field in the same
table. I need to do this for each record in the table.
This is the code I have written:
Dim DB As Database
Dim RS As Recordset
Dim Col As Field
Dim Col2 As Field
Set DB = CurrentDb()
Set RS = DB.OpenRecordset("tblPTOBenefits")
Set Col = DB.OpenRecordset("tblPTOBenefits").Fields
("LOS")
Set Col2 = DB.OpenRecordset("tblPTOBenefits").Fields
("YearlyPTOBenefit")
For Each Col2 In RS
If Col > 0 Then
Col2 = "$2000"
Else
Col2 = "$0"
Exit For
End If
Next
It is giving me a Data mismatch error and highlighting the
line "Set RS = DB.OpenRecordset("tblPTOBenefits")".
Can someone help me here?
Thanks, Lee
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|