?
Solved

Get selected table name

Posted on 2003-03-06
6
Medium Priority
?
233 Views
Last Modified: 2008-02-20
How can I get the name of a highlighted table in Access? I want a function that returns the name of the selected table.
0
Comment
Question by:carrp
[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
6 Comments
 
LVL 18

Expert Comment

by:1William
ID: 8082334
Where is the table going to be selected?  If it's in the database window you cannot (at least not easily.)  You could populate a list box with all table names eaisly enough.

For Each tdf In SourceDb.TableDefs
  .MoveFirst
    Do Until .EOF   ' Write the tdf.name to the list box, combo, whatever
        .MoveNext
      Loop
next
0
 

Author Comment

by:carrp
ID: 8082436
My intention was to right-click on a table icon in the database window and run a function on it. I already have that function written, but it needs the name of the table as an input. It's certain that the table will have focus when the function is run. If someone could provide me with code that simply pops up a message box with the table name, I can take it from there.
0
 
LVL 12

Expert Comment

by:nexusnation
ID: 8082535
'START!
For Each tdf In SourceDb.TableDefs
 .MoveFirst
   Do Until .EOF   ' Write the tdf.name to the list box, combo, whatever
       .MoveNext
     Loop
next
'END!

use this for a combo box on a pop up form. then, have your function run when a command button (also on this form) is clicked. the function can pull the table name from the combo box.

getting the idea?

nex
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:carrp
ID: 8083204
Nexus,

That's not a bad way to approach the problem, but it's not exactly what I'd like to accomplish.

I really want the function to return ONLY the name of the selected/highlighted table. This is because the name will be passed to another function, which manipulates data.

I want to be able to right-click the table (thus putting it in focus), and choose the function from the pop-up menu. I've already written code for the manipulation function, but I can't figure out a way to return only the name of the selected table. Any ideas?
0
 

Expert Comment

by:Banath
ID: 8137407
A request has been made to refund and/or delete this question; if there are no objections within 72 hours, the request will be granted.

EXPERTS: Please leave your thoughts on the disposition of this question here.

Banath
EE Moderator
0
 

Accepted Solution

by:
Banath earned 0 total points
ID: 8160816
Per request - refunding points & PAQing.

Banath
EE Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

777 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