Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Get selected table name

Posted on 2003-03-06
6
Medium Priority
?
236 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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

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

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Beware when using the ListIndex and the Column() properties of a listbox in Access 2007.  A bug has been identified in the Access 2007 listbox code which can cause the .ListIndex property to return a -1, and the .Columns(#) property to return a NULL…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

571 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