Can someone please tell me what is wrong with my code below? If I use "User" as the table name my code does NOT work, but if I name it something else it works just fine!
strFirstName = InputBox("First name?")
strLastName = InputBox("Last name?")
strUserName = InputBox("Username?")
strPassword = InputBox("Password?")
strDept = InputBox("Dept?")
strProgram = InputBox("Program?")
strSourceFile = "C:\User.mdb"
Set objADO = CreateObject("ADODB.Connection")
objADO.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strSourceFile)
strSQL = "INSERT INTO User (User First Name], [User Last Name], [User Login Name], [User Password], [User Department], [User Program]) " & _
"VALUES ('"& strFirstName &"', '"& strLastName &"', '"& strUsername &"', '"& strPassword &"', '"& strDept &"', '"& strProgram &"');"
objADO.Execute(strSQL)
objADO.Close
strFirstName = InputBox("First name?")
strLastName = InputBox("Last name?")
strUserName = InputBox("Username?")
strPassword = InputBox("Password?")
strDept = InputBox("Dept?")
strProgram = InputBox("Program?")
strSourceFile = "C:\User.mdb"
Set objADO = CreateObject("ADODB.Connection")
objADO.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strSourceFile)
strSQL = "INSERT INTO User (User First Name], [User Last Name], [User Login Name], [User Password], [User Department], [User Program]) " & _
"VALUES ('"& strFirstName &"', '"& strLastName &"', '"& strUsername &"', '"& strPassword &"', '"& strDept &"', '"& strProgram &"');"
objADO.Execute(strSQL)
objADO.Close