Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: append data to a field

    I have a question about append a text (txtNote) that user enter to a field named note in the database.
    I found when the note is not null, it will append to it. But if the note is null, it didn't append the txtNote to note field. The following is my code. Did i do anything wrong. Thanks.

    Private Sub cmdSave_Click()
    On Error GoTo Err_cmdSave_Click


    If txtNote.Value = "" Then
    'MsgBox "The note field can't be empty"
    'Exit Sub
    'End If

    Note = Note + txtNote.Value

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70


    Exit_cmdSave_Click:
    Exit Sub

    Err_cmdSave_Click:
    MsgBox Err.Description
    Resume Exit_cmdSave_Click

    End Sub

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Here is the simplified pseudo logic you want to use
    Code:
    If IsNull(Me.txtNote.Value) Then
     MsgBox "No blank notes please Sir!"
    Else
     DoCmd.Save
    End If
    Can you tell me what this line:
    Code:
    Note = Note + txtNote.Value
    Is supposed to be?
    George
    Home | Blog

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Have a look here. You should get it by the time you have read through post 5.
    http://www.dbforums.com/showthread.php?t=1620841

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Mar 2004
    Posts
    660
    Thanks. I change the null value to "" then it works. I have another question. How to add date to note. I thing i need to convert the date type to string before add it to note field.
    Thanks.

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Did you read the link? If you don't "get it" let me know.

    Look up the format() function on formatting dates to strings.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    Mar 2004
    Posts
    660
    Yes, thanks. I got it work. Thanks again! I still have a question about how to write the total amout from a query to an existing excel which is a template. I need to put the amount to a particular cell. I have no idea how to do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •