473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Access VBA - CurrentDb.Recordsets is empty

As my Access 2002 form opens, I want to find the names of the tables in the current Access database and populate a combobox with them. Problem is, the CurrentDb.Recordsets object is empty even though I have two tables in the database. I'm using the code below, but the combobox remains empty. That's because CurrentDB.Recordsets is empty. Is this a bug with CurrentDb or have I done something dumb?

Expand|Select|Wrap|Line Numbers
  1. Dim TBL As DAO.Recordset
  2.  
  3. For Each TBL In CurrentDb.Recordsets
  4.     Combobox.RowSource = Combobox.RowSource & TBL.Name & ";"
  5. Next TBL
  6.  
Mar 21 '07 #1
4 4519
MMcCarthy
14,534 Expert Mod 8TB
Just set the combobox Row Source to this query ...
Expand|Select|Wrap|Line Numbers
  1. SELECT MsysObjects.Name
  2. FROM MsysObjects
  3. WHERE (((MsysObjects.Name) Not Like '~*' And (MsysObjects.Name) Not Like 'MSys*') AND ((MsysObjects.Type)=1))
  4. ORDER BY MsysObjects.Name;
  5.  
Mary
Mar 21 '07 #2
ADezii
8,834 Expert 8TB
As my Access 2002 form opens, I want to find the names of the tables in the current Access database and populate a combobox with them. Problem is, the CurrentDb.Recordsets object is empty even though I have two tables in the database. I'm using the code below, but the combobox remains empty. That's because CurrentDB.Recordsets is empty. Is this a bug with CurrentDb or have I done something dumb?

Expand|Select|Wrap|Line Numbers
  1. Dim TBL As DAO.Recordset
  2.  
  3. For Each TBL In CurrentDb.Recordsets
  4.     Combobox.RowSource = Combobox.RowSource & TBL.Name & ";"
  5. Next TBL
  6.  
Expand|Select|Wrap|Line Numbers
  1. Dim MyTable As TableDef
  2.  
  3. For Each MyTable In CurrentDb.TableDefs
  4.   'No reason to see the System Tables
  5.   If Left$(MyTable.Name, 4) <> "MSys" Then
  6.      MsgBox MyTable.Name
  7.   End If
  8. Next
Mar 21 '07 #3
Thanks!!!!!

Expand|Select|Wrap|Line Numbers
  1. Dim MyTable As TableDef
  2.  
  3. For Each MyTable In CurrentDb.TableDefs
  4.   'No reason to see the System Tables
  5.   If Left$(MyTable.Name, 4) <> "MSys" Then
  6.      MsgBox MyTable.Name
  7.   End If
  8. Next
Mar 22 '07 #4
ADezii
8,834 Expert 8TB
Thanks!!!!!
No problemo.
Mar 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
6
by: Marlene | last post by:
Hi All I have the following scenario, where I have found all the duplicates in a table, based on an order number and a part number (item).I might have something like this: Order PODate Rec...
2
by: Armando | last post by:
This is driving me nuts - I 'm trying to open a table programmatically, to add or modify records, and I can't put all the pieces together to make it work in Access 2000. I have all sorts of apps...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
12
by: Cy | last post by:
Hello Fellow New Group Folks, Here's today's problem. I was called in to help convert an Access 97 database to Access 2000. 99% of all my Access Dev. work has occurred in 2000, so I know very...
4
MMcCarthy
by: MMcCarthy | last post by:
The following code is simply an example of some code that processes through two recordsets. It can be helpful for anyone curious as to how to start processing with recordsets (Which objects to refer...
1
by: sphinney | last post by:
As my Access form opens, I want it to find the names of the tables in the current Access database and populate a combobox with the table (recordset) names. Problem is, the CurrentDb.Recordsets...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
13
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between...
11
by: BeckR | last post by:
Hello - Thanks for reading my post. I am a newbie when it comes to VBA programming, but have managed to do what I need to do, until now. I have an Access 2000 database (running WinXP Pro...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.