is there a way to add fields to a table through the use of a form?
after thats done is it possible to then automatically add this field to a query based on this table?
is there a way to add fields to a table through the use of a form?
after thats done is it possible to then automatically add this field to a query based on this table?
I found the question very interesting and this is how you can do it.
I have a table called Table1
I have a Form called Form1
I have three text boxes in it
textBox1=you will type your Table name in it e.g. Table1
textbox3=you will type the field name you want to create e.g. Salary,Employee_Name
textbox5=you will type the field datatype e.g. Text, Number, Auto Number.
Command button 0=in its OnClick event you will type the following code:
Private Sub Command0_Click()
Dim TableName As String
Dim ColumnName As String
Dim Datatype As String
Dim MasterSQL As String
TableName = "ALTER TABLE" & " " & Me.Text1
ColumnName = "ADD COLUMN" & " " & Me.Text3
Datatype = Me.Text5 & ";"
MasterSQL = TableName & " " & ColumnName & " " & Datatype
DoCmd.RunSQL MasterSQL
End Sub
this should do the trick.
if your problem is solved please mark the thread as solved
I am just curious whether you were able to solve your problem if yes please mark this thread solved as then it will help someone else with the same problem find a solution easily.
thanx