Below is my code for my program. I am stuck on the bottom code (SUB COMMAND 35) where I am trying to add a column to a table. The name of the column is REPO_NUM. I am getting an error code 'SYNTAX ERROR'. I would also like to add another InputBox and ask for a value that would be inserted in the column stating REPO_NUM. FYI, I am new at VB and SQL and Stewart Ross punched up Sub_Command 28.
Thanks,
Carl
Thanks,
Carl
Code:
Option Compare Database
Private Sub Command7_Click()
DoCmd.RunCommand acCmdImportAttachExcel
End Sub
Private Sub Command28_Click()
Dim StrSql As String
Dim tblname As String
MyValue1 = InputBox("Enter File Number", "MyInputbox")
tblname = "Sheet" & MyValue1
StrSql = "DELETE * FROM [" & tblname & "] WHERE Physician_Comment <>'y'"
DoCmd.RunSQL StrSql
End Sub
Private Sub Command35_Click()
Dim StrSql As String
Dim tblname As String
MyValue = InputBox("Enter Report Number Column", "MyInputbox")
tblname = "Sheet" & MyValue1
StrSql = "ALTER [" & tblname & "] ADD COLUMN REPO_NUM"
DoCmd.RunSQL StrSql
End Sub
Comment