Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Access
3rdpartyusrgrp
access
activexcontrol
adp.sqlserver
commandbarsui
conversion
dataaccess.pages
developers.toolkitode
devtoolkits
externaldata
forms
formscoding
gettingstarted
internet
interopoledde
macros
modulescoding
modulesdaovba
modulesdaovba.ado
multiuser
odbcclientsvr
queries
replication
reports
security
setupconfig
tablesdbdesign
  
 
date: Thu, 20 Dec 2007 18:49:22 -0800,    group: microsoft.public.access.modulesdaovba.ado        back       


Problem w/String name for a recordset field   
I am using a string name to refer to a field in a table.  When I plug it into 
the code, it is not being recognized as a field.  I tried to use a Field 
object, which also didn't work.  Here's the code:

With rs
         .Index = "CounselorID"
         .Seek "=", Val(strCounselor)
         If .NoMatch Then
                 .AddNew
                  !CounselorID = strCounselor
                  !CategoryIdentifier = intCategory
                  ![(insert string field name value here)] = 
rsFindWrong![(insert string field name value here)]
                  ![(insert string field name value here)]  = 
rsFindWrong!CountOftxtMID
                  .Update
         Else...
         End IF...
End With...

What should I insert in the brackets to make this work, assuming the string 
field names are strField1 and strField2?
date: Thu, 20 Dec 2007 18:49:22 -0800   author:   rs0905

Re: Problem w/String name for a recordset field   
Change your fields to .Fields(string field name value here)


Rob

"rs0905"  wrote in message 
news:18566C97-18B7-43D2-BA56-A3F41622E006@microsoft.com...
>I am using a string name to refer to a field in a table.  When I plug it 
>into
> the code, it is not being recognized as a field.  I tried to use a Field
> object, which also didn't work.  Here's the code:
>
> With rs
>         .Index = "CounselorID"
>         .Seek "=", Val(strCounselor)
>         If .NoMatch Then
>                 .AddNew
>                  !CounselorID = strCounselor
>                  !CategoryIdentifier = intCategory
>                  ![(insert string field name value here)] =
> rsFindWrong![(insert string field name value here)]
>                  ![(insert string field name value here)]  =
> rsFindWrong!CountOftxtMID
>                  .Update
>         Else...
>         End IF...
> End With...
>
> What should I insert in the brackets to make this work, assuming the 
> string
> field names are strField1 and strField2?
date: Thu, 20 Dec 2007 22:28:02 -0500   author:   Robert Morley

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us