This post was actually inspired by a question I received from this site’s chatbot.
In this post you will find how you can use Access VBA and the DoCmd.CopyObject method to copy
a blank table, and append the value of a combobox to it.
The database has just one blank table “tblFacilityBlank”, that we’ll copy and paste for each facility.
Here is the picture of the form that will be used as a “work horse” (it will do all the work)
Basically, all you do is select a facility from the drop down box, and the selected text will get appended to the blank table.
Then a blank table will be created for the selection made.
Here is the code:
Private Sub btnMakeTable_Click()
Dim strNewName As String
'append the combo box selected value to the text
strNewName = "Facility_" & Me.cboFacility
DoCmd.CopyObject , strNewName, acTable, "tblFacilityBlank"
That’s all, let me know if you have any questions.
Here is the working example:by