Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / July 2007

Tip: Looking for answers? Try searching our database.

Syntax for using a variable as part of an object name.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
smithrn01@netzero.net - 19 Jul 2007 19:30 GMT
I have 10 cells named UI1 through UI10.  I want to put data into the
cells through a For loop.  What is the proper syntax to use a variable
as part of the object name?

In the sample below, CELL1 is a variable whose value is the name of
the field where I want to enter data.  I need to have VB recognize the
value of the variable as the field name.

Dim Cell1, DATA1 as variant
Dim x as integer

<DATA1 - calculated >
For x = 1 to 10
CELL1 = "UI" & x
            RS.Edit
            RS!CELL1 = Data1  --   Error - What is the proper
syntax?
            RS.Update
    <Change Data1>
Next x

Smitty
Douglas J. Steele - 19 Jul 2007 20:08 GMT
RS.Fields(CELL1)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> I have 10 cells named UI1 through UI10.  I want to put data into the
> cells through a For loop.  What is the proper syntax to use a variable
[quoted text clipped - 18 lines]
>
> Smitty
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.