To one and all,
Thanks in advance for helping me.
I have tried to lookup this answer, using error 13 and type mismatch, but to no avail and am sure it is easy but for the life of me cannot work it out.
I have the following part of code in a module:-
Sub CreateNewTableFromTextboxes(frm As Form)
Dim strRecSource As String
Dim strSqlLeft As String
Dim strsqlRight As String
Dim NameTable As String
Dim StrFields As String
Dim ctl As Control
Dim tdfNew As TableDef
NameTable = "tblMailshot sent " & Format(Date, "dd-mm-yyyy")
NewName:
Set db = CurrentDb
' Create a new TableDef object.
Set tdfNew = db.CreateTableDef(NameTable)
With tdfNew
' Create fields and append them to the new TableDef
' object. This must be done before appending the
' TableDef object to the TableDefs collection of the
' Northwind database.
For Each ctl In frm.Detail.Controls
AVOVE IS WHERE THE CODE FAILS
When I try and call it from a command button with:-
Dim MnFrm As Form
Set MnFrm = Forms(Application.CurrentObjectName)
modCreateTable.CreateNewTableFromTextboxes (Forms(MnFrm).Form)
I get the runtime error 13 message, type mismatch.
What I am trying to do is scan the current form for all the textbox names.
Any help would be much apprciated.
Regards
Steev
Thanks in advance for helping me.
I have tried to lookup this answer, using error 13 and type mismatch, but to no avail and am sure it is easy but for the life of me cannot work it out.
I have the following part of code in a module:-
Sub CreateNewTableFromTextboxes(frm As Form)
Dim strRecSource As String
Dim strSqlLeft As String
Dim strsqlRight As String
Dim NameTable As String
Dim StrFields As String
Dim ctl As Control
Dim tdfNew As TableDef
NameTable = "tblMailshot sent " & Format(Date, "dd-mm-yyyy")
NewName:
Set db = CurrentDb
' Create a new TableDef object.
Set tdfNew = db.CreateTableDef(NameTable)
With tdfNew
' Create fields and append them to the new TableDef
' object. This must be done before appending the
' TableDef object to the TableDefs collection of the
' Northwind database.
For Each ctl In frm.Detail.Controls
AVOVE IS WHERE THE CODE FAILS
When I try and call it from a command button with:-
Dim MnFrm As Form
Set MnFrm = Forms(Application.CurrentObjectName)
modCreateTable.CreateNewTableFromTextboxes (Forms(MnFrm).Form)
I get the runtime error 13 message, type mismatch.
What I am trying to do is scan the current form for all the textbox names.
Any help would be much apprciated.
Regards
Steev