So the system I'm coding right now is for account creation. The code I'm using to append the new account information is as follows:
Code:
CurrentDb.Execute "INSERT INTO AcctInfo (Username, Password, AcctOwner, Email, CreationDate) VALUES (" & TextUsername.Value & "," & TextPassword.Value & "," & TextName.Value & "," & TextEmail.Value & "," & Date & ")"
I'm getting an error when it gets to the email field. If I have an @ in the text box (which I have to to enter the email), I get a Missing operator, and the error message displays the text in the email text box. If it doesn't have an @, I get a too few parameters (and either an expecting 3 or expecting 2)
Are there syntax errors in this statement? Is there something wrong with using an @ symbol in the text field?
Any help would be greatly appreciated.
Edit: FIXED Missing Operator with Chr(39) delimiters around TextEmail.Value. New Code:
Code:
CurrentDb.Execute "INSERT INTO AcctInfo (Username, Password, AcctOwner, Email, CreationDate) VALUES (" & TextUsername.Value & "," & TextPassword.Value & "," & TextName.Value & "," & Chr$(39) & TextEmail.Value & Chr$(39) & "," & Date & ")"
I'm still getting a too few parameters error (expecting 2). Why is this?
It's also important to note I had previously opened the database as a DAO.Recordset earlier, but I still closed it before running this line. Could this be the issue?