Here's some sample code. I haven't tested it, but it should give you
the idea.
Public Function Testing()
'Access97
Dim db As database
Dim rs As Recordset
Dim var1 As Variant, var2 As Variant
Set db = CurrentDb()
Set rs = db.OpenRecordset("myTable", dbOpenTable)
With rs
If .EOF Or .BOF Then
MsgBox "Sorry, boss. Ain't nothin' there!"
Else
While Not .EOF
.Edit
var1 = .Fields!fldName1
var2 = .Fields!fldName2
'do whatever processing necessary
.Update
.MoveNext
Wend 'eof
End If
End With
Set rs = Nothing
Set db = Nothing
End Function
Quote:
> This one should be easy because I have never written an Access module before
> and just need to get started.
> I have a table with about 20 fields. For each record I want to read in 2
> fields and compare the 2 fields(not directly but through a formula). How do
> I open the table and record and assign the fields to variables?
> I know enough vb that I should be able to do the rest.
> Thanks,
> Tom