Solved

Macro in Visual Basic

Posted on 1999-01-27
1
203 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
1 Comment
 
LVL 1

Accepted Solution

by:
batdan earned 20 total points
ID: 1470907
Instead of:

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

Hope this is OK.   Regards.

use:

For TempStoreNumber = 0 To NumberOfArray
 
           X1 = TempArrayfieldname(TempStoreNumber)
           MSFlexGrid1.TextMatrix(1,TempStoreNumber) =rsiled(X1).Value

Next
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
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…

759 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

17 Experts available now in Live!

Get 1:1 Help Now