Solved

How to make a Data Control a variable name??

Posted on 1998-07-28
2
129 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 91
passing a value with stream reader AFTER a ";" 3 90
How to Add / Edit Windows Menu 4 80
MsgBox 4 75
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…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

739 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