I have created a table named "MapDetail" : the FIELDS identify the formname, the name of the textbox , and data to be transferred to that textbox.

My form contains a map of city lots. Each of these lots contain a Textbox.
My objective is to load each Textbox with the desired information via a VBA Function.

The Function will be passed the formname.
The function will then sequentially fills each of the textboxes from the "MapDetail" table

Please note that each form can have a varying amount of textboxes. So I prefer to us a Do Loop

The Problem for me lies in the transfer of Data from the table to the form textbox.

I would like to find a way to convert "vMyString" to the actual command to load the data into the target text box. Example:

        vFormName = “tmp_Template”  
        vMapBox = rst2![MapBox]       ' Name of the TextBox Control on the Form  {“Text2”}
        vBlockID = rst2![BlockID]          ' Data to be placed into the TextBox

       v MyString = "Forms!" & vFormName & "!" & vMapBox 

It needs to perform the following form update via vMyString:

                             Forms!frm_Template!Text2 = vBlockID

(vBlockID is the data that I want to transfer to the Text2 box on the form.)

Any thoughts on how to convert vMyString into the transfer vehicle?

the answer turned out to be sweet and simple:
resolution:

Forms(vFormName).Controls(vMapBox).Value = vBlockID
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.