Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a basic Form from a Table with VB 1

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I tried this question under the Forms and Access Modules (Coding)....Forums. I did not get any responses. If anyone can help please or direct me where I can get help.

1. In MS Access 2013 I can single click a Table in the table list - In design view. With a table highlighted I can select the Create Ribbon and select Forms and then select Form. This will create a very basic Form based on the selected Table and display it.

2. What I am currently doing with VB is loading and naming Tables from a selected spreadsheet. The code goes to each Sheet in the work book. For each Sheet it will create and load a Table in Access....using the Sheet name as the new Table name. It then repeats for each remaining Sheet in the work book.

3. What I would like to include, after each Table is built and populated, is to create the "basic" form described in Paragraph 1 above. I have described what can be done manually but need to be able to do it from code. I have searched the net using various criteria looking for an answer. I have not found anything even close.

I have tried the DoMenu functionality but the "Create - Forms - Form" button is not on the list of menu items VB can work with.
I have also used the file menu and the SaveAs selection with the table open. I can save it as a form but again I cannot find a way to do this in VB. It seems VB cannot do SaveAs.

Any suggestions would be very helpful to myself and my users here at work.

Then, of course, using the VB to create a basic report would also be useful...but that comes after the Form
 
You can try use something like:
Code:
Docmd.RunCommand acCmdNewObjectAutoForm

You will need to first select an object or use VBA to select the object and then use DoCmd.

Duane
Vevey, Switzerland
Hook'D on Access
MS Access MVP 2001-2016
 
Duane. Great, thank you very much. I will give this a try in the next day or so. I will let you know how it turns out.
 
Duane,
Sorry it has been so long. Your suggest worked just great.

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top