Results 1 to 3 of 3
  1. #1
    pardhu81 is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    May 2017
    Location
    INDIA
    Posts
    7

    Question How to mention field names along with variables

    Dear All, I have textbox's where i renamed as TN1 , TN2, TN3, TN4 etc..


    I want to use these field names in vba. and i want to put in a loop these fields and update accordingly.
    while doing that i am looking for an syntax which looks something like below...

    Dim i as integer

    ME.TN & i = rst![FIELD]
    i = i + 1

    In above example i value increments in loop and updates the values which is available in recordset.
    Obviously above syntax thrown error. can you suggest me the right syntax..

    Thanks in Advance.

  2. #2
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Don't know what rst![Field] is about but the other part:

    For i = 1 to 10
    Me.Controls("TN" & CStr(i)) = rst![Field]
    Next

  3. #3
    pardhu81 is offline Novice
    Windows 8 Access 2013 64bit
    Join Date
    May 2017
    Location
    INDIA
    Posts
    7
    Wonderful.
    Now another issue..
    I have this text field in Tab Control.
    When i try to update it is throwing error saying.. "You Cant Assign a Value to this Object".

    How to handle text field which is placed on Tab Control?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Variables in query field
    By saechaoc in forum Access
    Replies: 3
    Last Post: 09-22-2015, 02:47 PM
  2. No mention of ADO or DAO in References...
    By MatthewGrace in forum Programming
    Replies: 3
    Last Post: 11-15-2014, 11:23 AM
  3. Replies: 5
    Last Post: 12-22-2012, 01:36 PM
  4. Replies: 9
    Last Post: 02-17-2011, 03:33 PM
  5. Quick way to stuff field names into text field
    By kfinpgh in forum Programming
    Replies: 0
    Last Post: 01-04-2007, 01:13 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums