Button Always Appends 8 Rows Instead of 1

slaterino

Registered User.
Local time
Today, 04:06
Joined
Dec 2, 2008
Messages
14
Hi,
I have created a form with a text box. Under the text box is a button with a command to open an append query and enter the contents of the text box along with two other fields into a table. This works fine except that it always appends 8 identical rows instead of just the 1 it should be doing. I can't for the like of me work out the problem!

The code for the button click is:

Code:
Private Sub cmdSaveNote_Click()
On Error GoTo Err_cmdSaveNote_Click

    Dim stDocName As String

    stDocName = "qry_append_notes"
    DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_cmdSaveNote_Click:
    Exit Sub

    MsgBox ([New Note Input])
    
    Me.Refresh

Err_cmdSaveNote_Click:
    MsgBox Err.Description
    Resume Exit_cmdSaveNote_Click

End Sub

The append query is quite basic. There are 3 fields. The first one just enters today's date so has field value "Date Written: Date()". The second one takes the contents of the text box so is "Notes: [Forms]![frmSearch]![AddNoteBox]" and the last one takes the URN, which is my unique ID and has value "URN: [Forms]![frmSearch]![URN]".

Does anyone know what could be causing this? Any help would be muchly appreciated!!!

Thanks
Russ
 
Is the form by chance a continuous form?
 
Can you post the SQL of your Append Query.
 
Hi, I think I've solved it! My SQL was:

Code:
INSERT INTO tbl_Notes ( Date_Written, Notes, URN )
SELECT Date() AS [Date Written], [Forms]![frmSearch]![AddNoteBox] AS Notes, [Forms]![frmSearch]![URN] AS URN
FROM tbl_notes;

I've now removed the line 'FROM tbl_notes' as it was superluous and hey presto! Works a charm!

I have one other question if anyone can maybe help though. I'm using a different form to send e-mails. Does anyone know whether it's possible to add rich text using a text box? I want the body of the e-mail to have paragraphs at least and maybe even bold text in but can't seem to find a way to actually be able to do this.

Cheers
Russ
 
I'm not sure about rich text but you should be able to obtain paragraph breaks by embedding carriage return and line feed characters in your text...

??

Edit: Something like:

"My Text" & vbcrlf & vbcrlf & "My second paragraph text"
 

Users who are viewing this thread

Back
Top Bottom