I have a form (Form1) with one field (text box "N1")
on this form I have a button with on click action related to (text box "Text2")
when clicking the button a table with a name entered in the text box is created.
this is the vb code used to create the said table:
Private Sub Command0_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim tdfNew As TableDef
Dim fldNew As Field
'--- set a reference to the database
Set db = CurrentDb
'--- create the table
Set tdfNew = db.CreateTableDef(Text2)
'--- add integer field
Set fldNew = tdfNew.CreateField("ClientID", dbInteger)
'--- save the new field
tdfNew.Fields.Append fldNew
'--- add text field (length 20)
Set fldNew = tdfNew.CreateField("ClientName", dbText, 20)
'--- save the new field
tdfNew.Fields.Append fldNew
'--- save the new table design
db.TableDefs.Append tdfNew
'---Initialize your recordset
Set rs = CurrentDb.OpenRecordset(Text2, dbOpenDynaset)
' Add New Record
'--- Clear memory
Set fldNew = Nothing
Set tblNew = Nothing
Set db = Nothing
End Sub
My problem starts when I try to related Form1 to the table created
i.e. to the table which takes its name from the text box Text2
any clew
thanks in advance