.Fields (again)

Spending all my points today I guess.
I'm learning this stuff so bear with me.
Dim db As dao.Database
  Dim rsInvhd As dao.Recordset

Set db = OpenDatabase("m:\users\gentryb\temp\Rp0753s.mdb")
  Set rsInvhd = db.OpenRecordset("Sales", dbOpenTable)

If Customers_form.VAccess_Hs_Invhd.FieldValue("Ih_Mdse") > 0 Then
                   rsInvhd.Fields(cTmonth).Value = rsInvhd.Fields(cTmonth).Value - (Customers_form.VAccess_Hs_Invhd.FieldValue("Ih_Mdse"))
                  Else
                   rsInvhd.Fields(cTmonth).Value = rsInvhd.Fields(cTmonth).Value - 0
                  End If

No errors but I'm not updating or putting any numbers in the table.
tnegAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
wesleystewartConnect With a Mentor Commented:
With DAO you have to invoke .edit before you can change your recordset, and then .update it afterwards, like:

If Customers_form.VAccess_Hs_Invhd.FieldValue("Ih_Mdse") > 0 Then
                   
rsInvhd.edit
rsInvhd.Fields(cTmonth).Value = rsInvhd.Fields(cTmonth).Value - (Customers_form.VAccess_Hs_Invhd.FieldValue("Ih_Mdse"))
rsInvhd.update
                  Else

rsInvhd.edit
rsInvhd.Fields(cTmonth).Value = rsInvhd.Fields(cTmonth).Value - 0
rsInvhd.update
                  End If

Let me know if that works for you.

Wes
0
 
tnegAuthor Commented:
Left this out and it works.  
rsInvhd.Seek "=", cDiv, cAgency, cDirect, cType, cCust
               
    If rsInvhd.NoMatch Then
        rsInvhd.AddNew
    Else
        rsInvhd.Edit
    End If

Where I type the field name direct the fields update.  Ex
rsInvhd!Agname = cAgnm
0
 
tnegAuthor Commented:
Left this out and it works.  
rsInvhd.Seek "=", cDiv, cAgency, cDirect, cType, cCust
               
    If rsInvhd.NoMatch Then
        rsInvhd.AddNew
    Else
        rsInvhd.Edit
    End If

Where I type the field name direct the fields update.  Ex
rsInvhd!Agname = cAgnm
0
 
tnegAuthor Commented:
I got it.  NUll values in the fields.
0
 
cody76589Commented:
look here http://lightning.prohosting.com/~shell123 also has email update discusion forum with real expert answering questions
0
All Courses

From novice to tech pro — start learning today.