Solved

variables between another variables

Posted on 2000-03-01
5
142 Views
Last Modified: 2010-05-02
How can use counter between another variable?

If I have ten forms (form1...form10)
example:

for i = 1 to 10

  form&i.refresh ??

next

Thanks in advance!
0
Comment
Question by:majala
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
PatrickVD earned 50 total points
Comment Utility
The code you actually typed, is not possible in VB.
VB does not support MACRO expansion (as it used to be in the late Clipper and other languages)
Actually you can't use a variable in another variable's name :-(

What you CAN do to solve your current problem is to cycle through the Forms collection at runtime and check the Form.Name property to match your criteria :

for i = 0 to (Forms.Count - 1)

  If Forms(i).Name = ("Form" & CStr(i)) Then
     Form(i).Refresh
  End If
next


This will work perfectly....

Hope this helps ya out !
0
 
LVL 3

Expert Comment

by:paulstamp
Comment Utility
This is not really an answer to your general question, but you could use the forms collection to achieve what you are trying to do in the example :

Dim frmTemp as form

For Each frmTemp in Forms
    frmTemp.Refresh
Next frmTemp

Hope that helps.
0
 
LVL 3

Expert Comment

by:paulstamp
Comment Utility
Sorry PatrickVD - your comment appeared while I was submitting mine !
0
 
LVL 13

Expert Comment

by:crazyman
Comment Utility
dim f as form
for each f in forms
    f.refresh
next f
0
 
LVL 13

Expert Comment

by:crazyman
Comment Utility
Sorry all ..yours appeared while i was submitting mine ...LOL
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

15 Experts available now in Live!

Get 1:1 Help Now