Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Strings not appending to memo field

Status
Not open for further replies.

DRH192

Programmer
Apr 25, 2005
96
GB
Is there any reason why when using a DAO.Recordset to update/add a table record, I can only get the first line of a notes field to append to the memo field in which it should be going?

The enter key behaviour of the notes field is new line, and its a normal text box.

The code is as follows

Function AddCalc(frm As Form)

DoCmd.SetWarnings True

Dim RS As DAO.Recordset
Dim db As DAO.Database

Set db = CurrentDb
Set RS = db.OpenRecordset("Select * from tblNonReturns")

RS.AddNew
RS!CalcType = SF_replaceAll(SF_splitRight(frm.Name, "CALC_"), "_", " ")
RS!FieldNotes = CalcStrVals(frm)
RS!Notes = frm!Notes 'Line giving me problems!
RS!StandardNonReturns = frm!NonReturns
RS!SumPosAdj = frm!TotalAdjustments
RS!SumNegAdj = frm!NTotalAdjustments
RS!NetNonReturns = frm!NetNonReturns
RS.Update
RS.Close

End Function

So the field "Notes" which is a memo is only recieving the first line of text from the text box on the form(frm).

Any help greatly appreciated.
 
First, since this method doesn't return a value to anything, it should be a SUB as opposed to a FUNCTION. Functions generally take a value and return a value, just like a "function" in math.

This line looks a little strange. Are these user-defined functions? SF_replaceAll(SF_SplitRight()) ?
RS!CalcType = SF_replaceAll(SF_splitRight(frm.Name, "CALC_"), "_", " ")

Have you tried debugging at all? Set a break point on the line that gives you problems, execute the code, then hold your mouse cursor over some of your variables to make sure they're holding the values you're expecting. Once confirmed, use the "step into" option to advance your code a line further, and check again.


~Melagan
______
"It's never too late to become what you might have been.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top