Variable Field name

I am using a dao record set and updating an Access table.  I have field names for the months for this year and last year.  (ex  PJAN,TJAN,PFEB,TFEB).  I look at a date and know that 01 is January, 02 is February etc  and store PJAN or what ever field it should be in a strin variable...strPmonth and strTmonth.  When I update the record set I want to say rsInvhd!strPmonth.  What is the syntax?  I've fought through all the hard stuff and get to something simple and just can't figure it out.  I put the point value high because I need to know
Who is Participating?
rovermConnect With a Mentor Commented:
Don't use ! but the Fields property: rsInvhd.Fields(strValue).Value = ... and so on!
Good Luck !

grtx, Mark
what's mean?
can you write some code even if it's not work
Hey Tneg I haven't done that much DB programming but I have used the ! operator before and when I used it the syntax was as follows.

    With recordsetName
          .MoveFirst 'Or the record u wish to update
    end with  

So as far as I know for straight forward use it is used exactly like a variable.
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

rs = filled recordset and minimal keyset cursor,
strMonth = month to update
strValue = update value

rs.Field(strMonth).Value = strValue

The Field prop offers some nice features, you can also check if the value isn't changed somewhere else by another user.
tnegAuthor Commented:
Great!  I'm almost there now

I used this prop in a DBGrid, if you like I to know why, how and what, let me know !

All Courses

From novice to tech pro — start learning today.