VBA to prompt for InputBox of all the Tables in a DB?

MikeL

Active Member
Joined
Mar 17, 2002
Messages
492
Office Version
  1. 365
Platform
  1. Windows
Hello,
Would like an InputBox where the user can pick from one of all the tables in the DB?
Sub GetTableNames() Dim tdf As TableDef For Each tdf In CurrentDb.TableDefs If tdf.Name Like "MSys*" Or tdf.Name = "Accesss System" Then Else result = InputBox("Enter value for " & tdf.Name, "Table Value Input", "Default Value") End If Next tdf End Sub
Thanks in advance,
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Input boxes don't open with information in them - you have to enter it yourself, then it returns the entered text to your code. Maybe what you want is a listbox list of non-system tables?
Code should be in code tags (use vba button on posting toolbar) and properly indented.
 
Upvote 0
Why would user be selecting a table? If it is to show fields/columns, then suggest, as micron did, a form with a listbox. Listbox rowsource could be all non-system tables, and user could select 1(or more tables) and the after update of the listbox could invoke a display of field/column names in the selected table. But, we really need to know more about the "business process" that you feel an inputbox is an appropriate solution.
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,703
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top