Here's the code I have:
Dim FullName As String
Dim Initials As String
Dim UserName As String
Dim Email As String
Dim ContactFileAs As String
Dim SplitName() As String
Dim InsertAdvisor As String
Dim FirstName As String
Dim LastName As String
Dim db As DAO.Database
Set db = CurrentDb()
FullName = txtFullName.Value
SplitName() = Split(FullName)
FirstName = SplitName(0)
LastName = SplitName(1)
ContactFileAs = SplitName(1) & ", " & SplitName(0)
InsertAdvisor = "INSERT INTO dbo_tblContact(FullName, ContactFileAs, FirstName, LastName, IsEmployee) VALUES(" & FullName & ", " & ContactFileAs & ", " & FirstName & ", " & LastName & ", -1)"
db.Execute (InsertAdvisor)
The text it's pulling from the txtFullName will be something like "John Smith". When it gives me this error, it will say Syntax error in query expression 'John Smith'.
Can anyone help me out here?
Dim FullName As String
Dim Initials As String
Dim UserName As String
Dim Email As String
Dim ContactFileAs As String
Dim SplitName() As String
Dim InsertAdvisor As String
Dim FirstName As String
Dim LastName As String
Dim db As DAO.Database
Set db = CurrentDb()
FullName = txtFullName.Value
SplitName() = Split(FullName)
FirstName = SplitName(0)
LastName = SplitName(1)
ContactFileAs = SplitName(1) & ", " & SplitName(0)
InsertAdvisor = "INSERT INTO dbo_tblContact(FullName, ContactFileAs, FirstName, LastName, IsEmployee) VALUES(" & FullName & ", " & ContactFileAs & ", " & FirstName & ", " & LastName & ", -1)"
db.Execute (InsertAdvisor)
The text it's pulling from the txtFullName will be something like "John Smith". When it gives me this error, it will say Syntax error in query expression 'John Smith'.
Can anyone help me out here?