By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Updating Memo Field from form Control

P: 9
I have a form with an unbound control called RevevantDateNotes. This is used to gather and update information stored on a table field of type Memo, with the same name (RevevantDateNotes).

The After Update [Event] is shown below:

I need to store an email (cut and past) of a resignation letter. When I cut and paste a letter into the form field, I get the following error with a portion of the letter embedded in the error message:

3075 - Syntax error in query expression "Date Wed 29 Oct 21:37:57 [about 255 characters of the letter, ending with single quote] . . . team. I expec'.

There are no single or double quotes embedded in the letter.

Looks like the statement "Dim RelevantDateNotes As String" limits me to 255 characters as when I remove spaces, a few more characters of the letter show up in the error message. When I dhortent he inout, it works without an error message.

How can I store the entire letter in the memo field.

-------------- Event Code ------------
Expand|Select|Wrap|Line Numbers
  1.  Private Sub RelevantDateNotes_AfterUpdate()
  2. On Error GoTo Err_RelevantDateNotes_AfterUpdate
  3.  
  4. Dim Member_ID As Integer
  5. Dim RelevantDateNotes As String
  6.  
  7. RelevantDateNotes = Me.RelevantDateNotes
  8. Member_ID = Me.Member_ID
  9.  
  10. 'update table with current notes
  11. temp_sql = "UPDATE tbl_J_MemberDates "
  12. temp_sql = temp_sql & " SET RelevantDateNotes = '" & RelevantDateNotes & "' "
  13. temp_sql = temp_sql & " WHERE mmMember = " & Member_ID & " "
  14.  
  15. DoCmd.SetWarnings False
  16. DoCmd.RunSQL (temp_sql)
  17. DoCmd.SetWarnings True
  18.  
  19. Exit_RelevantDateNotes_AfterUpdate: ' Label to resume after error.
  20. Exit Sub ' Exit before error handler.
  21.  
  22. Err_RelevantDateNotes_AfterUpdate: ' Label to jump to on error.
  23. MsgBox Err.Number & " - " & Err.Description ' Place error handling here.
  24. Resume Exit_RelevantDateNotes_AfterUpdate ' Pick up again and quit.
  25.  
  26. End Sub
Dec 15 '08 #1
Share this Question
Share on Google+
1 Reply


P: 9
Disregard. The above code works.
Dec 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.