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
Solved

How to make a Data Control a variable name??

Posted on 1998-07-28
2
127 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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.
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…

861 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