I am really swamped right now so let me point you generally to get you started. From your response it sounds like you are able to work your way around in code OK. This example uses a DAO recordset.
Depending on what version you are working with you may need to set a reference to it. To do that, while you are in your VB editor go to Tools, Click References and then scroll down until you come to the Microsoft list and select the highest DAO file listed (eg DAO 3.61) by checking the box next to it. If you close and reopen Tools, References it will now show up in the list.
Here is how you would use it in code. This is off the top of my head so there may be some syntax errors. If you hit F2 it will pop up the object browser. Select DAO from the libraries list and then you will see all of the properties and methods for DAO. Methods (subs or functions) look like green erasers. If you click on one of them and look down at the bottom it will show you the information needed to use it. If you right click it will also take you to help for that item.
Here is an example:
1. In your database create a table tblFamily with 4 fields:
FamilyID - Autonumber - Primary Key
FName - Text
LName - Text
Income - Currency
2. Create a query named qryFamily and select all fields
from tblFamily and sort it by LName and FName ascending
3. Enter data into the table and make sure you put some in
with different last names and out of order so you can
see the query work
4. Create this module and single step through it to get a
feel for how recordsets work
5. Note that fields are zero based
With rst / End With allows you to remove a level of
qualification (eg .fields instead of rst.fields)
Fields collection can be referenced by number or name
Sub RecordsetExample()
Dim rst As DAO.Recordset
Dim lngCount As Long
Dim lngIncome As Long
Set rst = CurrentDb.OpenRecordset("qryfamily"

rst.MoveFirst
Do While Not rst.EOF
With rst
lngIncome = lngIncome + .Fields("Income"

.Value
MsgBox .Fields(0).Value & vbCrLf & _
.Fields(1).Value & vbCrLf & _
.Fields(2).Value & vbCrLf & _
.Fields(3).Value & vbCrLf & _
lngIncome
rst.MoveNext
End With
lngCount = lngCount + 1
Loop
MsgBox "Total records: " & lngCount & vbCrLf & _
"Total Income: " & lngIncome
rst.Close
Set rst = Nothing
End Sub
Here are a couple alternatives for your code also:
1. Using If/ElseIf/Else
If inv_duration < 4 Then
inv_total = inv_rate / 3
ElseIf inv_duration > 18.666 Then
inv_total = inv_rate
Else
inv_total = ((inv_rate / 3) * (inv_duration / 7))
End If
2. Using Select Case
Select Case inv_duration
Case < 4
inv_total = inv_rate / 3
Case > 18.666
inv_total = inv_rate
Case Else
inv_total = ((inv_rate / 3) * (inv_duration / 7))
End Select
3. Presumably you want a running total in which case it
becomes inv_total = inv_total + (inv_rate / 3), etc.
Good Luck and Enjoy!
Have a great day!
j2consulting@yahoo.com