Solved

Macro in Visual Basic

Posted on 1999-01-27
2
168 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
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 20 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is MicroStrategy.NET? 2 65
Excel VBA, find a string in a column, update a cell 7 77
Recommendation vb6 to vb.net or others 14 142
Problem to With line 4 57
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now