doran_doran
Registered User.
- Local time
- Yesterday, 21:13
- Joined
- Aug 15, 2002
- Messages
- 349
insert into sql error
What is wrong with the following sql statement. Please see print screen for error.
My Goal: I am trying to grab user id, user name and today's date into a memo field call VisitorTrail. I would like this field to grow. So, data is added to old data in the field.
Also, How do I put extra 3 spaces between this value and "|" between them.
= = = = Code Begins Here = = = =
Private Sub Note_AfterUpdate()
Dim NoteBefore2 As String
Dim NoteAfter2 As String
Dim strSQL As String
NoteBefore2 = Nz(Me.Note.OldValue, "Null")
DoCmd.RunCommand acCmdSaveRecord
NoteAfter2 = Nz(Me.Note, "Null")
strSQL = "INSERT INTO tblNotes (visitorTrail)"
strSQL = strSQL & " Select " & Me!txtUserID & Me!txtDLookupAuthorName & Now() & Chr(10)
strSQL = strSQL & "FROM tblNotes"
strSQL = strSQL & "WHERE [NotesAutoId]=" & Me.txtNotesAutoID & ";"
If NoteBefore2 <> NoteAfter2 Then
Me!LastVisitorID = Me.txtUserID
Me!LastVisitorName = Me.txtDookupAuthorName
Me!LastVisitedDate = Now()
DoCmd.RunSQL strSQL
End If
End Sub
What is wrong with the following sql statement. Please see print screen for error.
My Goal: I am trying to grab user id, user name and today's date into a memo field call VisitorTrail. I would like this field to grow. So, data is added to old data in the field.
Also, How do I put extra 3 spaces between this value and "|" between them.
= = = = Code Begins Here = = = =
Private Sub Note_AfterUpdate()
Dim NoteBefore2 As String
Dim NoteAfter2 As String
Dim strSQL As String
NoteBefore2 = Nz(Me.Note.OldValue, "Null")
DoCmd.RunCommand acCmdSaveRecord
NoteAfter2 = Nz(Me.Note, "Null")
strSQL = "INSERT INTO tblNotes (visitorTrail)"
strSQL = strSQL & " Select " & Me!txtUserID & Me!txtDLookupAuthorName & Now() & Chr(10)
strSQL = strSQL & "FROM tblNotes"
strSQL = strSQL & "WHERE [NotesAutoId]=" & Me.txtNotesAutoID & ";"
If NoteBefore2 <> NoteAfter2 Then
Me!LastVisitorID = Me.txtUserID
Me!LastVisitorName = Me.txtDookupAuthorName
Me!LastVisitedDate = Now()
DoCmd.RunSQL strSQL
End If
End Sub
Attachments
Last edited: