Can anyone help me with the code for an ALTER TABLE commmand? I have a list box that lists all tables in database. The user chooses. I next want to add a column to this table. I might also want to delete a column from this table. what I have for code so far is:
Private Sub lstTableList_Af terUpdate()
Dim tblClientTable As String
tblClientTable = Forms!frmDailyC lient!lstTableL ist
Debug.Print tblClientTable
mAnswer = MsgBox("Add a field for LS Data?", vbYesNo)
If mAnswer = 6 Then
ALTER TABLE " & tblClientTable & " ADD COLUMN LSRate Long;"
End If
Me!lstFieldList .Visible = True
Me!lstFieldList .SetFocus
Me!lstTableList .Visible = False
End Sub
I am guessing that it doesn't like my variable. Is it because I have dim it as a string? Do I need to set is as "currentdb" ? Thanks again for any help!!
Private Sub lstTableList_Af terUpdate()
Dim tblClientTable As String
tblClientTable = Forms!frmDailyC lient!lstTableL ist
Debug.Print tblClientTable
mAnswer = MsgBox("Add a field for LS Data?", vbYesNo)
If mAnswer = 6 Then
ALTER TABLE " & tblClientTable & " ADD COLUMN LSRate Long;"
End If
Me!lstFieldList .Visible = True
Me!lstFieldList .SetFocus
Me!lstTableList .Visible = False
End Sub
I am guessing that it doesn't like my variable. Is it because I have dim it as a string? Do I need to set is as "currentdb" ? Thanks again for any help!!
Comment