Solved

How to make a Data Control a variable name??

Posted on 1998-07-28
2
125 Views
Last Modified: 2010-05-03
I have a form with several data controls to produce combo boxes that have lists from various tables to facilitate data input.  I'd like to try and shorten some of the code for queries.  I've got a select case statement started, but what I'd like to do is something like:

  datVariable = Data1

  RecCount(Index) = datVariable.Recordset.Recordcount
  (where Index is from a control array)

I don't recall the exact code at the moment, but I think you get the idea.

How can I make the data control a variable?  I've tried using string and variant but with no success.

Help would be greatly appreciated.

-- Stacey --
0
Comment
Question by:s033slb
2 Comments
 
LVL 6

Accepted Solution

by:
anthonyc earned 10 total points
ID: 1467033
dim x as object

set x = data1
reccount(index) = x.recordset.recordcount


You can also do this in your select case

select case 5
case 1
   szData = "data1"
case 2
   szData = "data2"
case 5
   szData = "data5"
end select

reccount(index) = me.controls(szdata).recordset.recordcount
0
 

Author Comment

by:s033slb
ID: 1467034
This worked great!!

Thanks
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…
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…

705 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

19 Experts available now in Live!

Get 1:1 Help Now