Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Macro in Visual Basic

Posted on 1999-01-27
2
Medium Priority
?
174 Views
Last Modified: 2013-11-25
To_Experts

I have a problem regarding macro which i described
below.Here i retrieve fieldname from array.
e.g.-> "SR_NO" is fieldname

coding:

Dim TempStoreNumber As Integer
Dim NumberOfArray As Integer
dim rsiled as recordset

For TempStoreNumber = 0 To NumberOfArray
 With rsiled
  X1 = "!" + TempArrayfieldname(TempStoreNumber)
  MSFlexGrid1.TextMatrix(1,TempStoreNumber) = " " & X1 & " "
 End With
Next
      
Points:

 1) I got x1 = "!SR_NO"  
 2) I got msflexgrid1.textmatrix(1,TempStoreNumber)="!SR_NO"            

Both are same.Actually in first point i got correct value(field name).
But in second point i want value of that value(means fieldname's value).

I want the value of "SR_NO" (Fieldname of a table) from table.
which i want to pass in msflexgrid which i mentioned below.

   msflexgrid1.textmatrix(1, TempStoreNumber) =


Please reply us with full coding.

with warm regards,
Bhavesh Patel
0
Comment
Question by:Aurokripa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Expert Comment

by:batdan
ID: 1470908
You may want to delete this question.  It has been posted twice!
0
 
LVL 12

Accepted Solution

by:
mark2150 earned 40 total points
ID: 1470909
It's not going to work. The field name is being interpritted as a string and *NOT* as a field reference.

Set db = Workspaces(0).OpenDatabase(datadir)
For Each Table In db.TableDefs
    work = Table.Name
    If UCase(Left(work, 4)) <> "MSYS" Then Combo1.AddItem Table.Name
Next Table
'
Data1.Caption = datadir
Data1.DatabaseName = datadir           'set link to database
Combo1.ListIndex = 0
Set Data1.Recordset = db.OpenRecordset(Combo1.Text) ' Defaults to Table object.

For Each td In db.TableDefs
For Each fd In td.Fields
        Printer.Print fd.Name
Next fd
next td

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question