Solved

Macro in Visual Basic

Posted on 1999-01-27
1
205 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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