473,846 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add to a memo field

Hi All,
here is what I am trying to achieve. I have a memo field on a form which
users will need to add to as and when. I do not want them to be able to edit
information which already exists within this field.

My idea was to have the memo field locked on the form to stop edits.
Place a command button by the memo field which opens an unbound form with a
single text box.
The user enters their update into the unbound form and upon closing it, the
text they entered will be added to whatever information already exists
within the memo field.
I have tried running the following code upon click a command button on the
unbound form:

On Error GoTo UpdateMemoError
Dim strSQL As String

strSQL = "UPDATE tbl_IRS SET tbl_IRS.Details = " & _
"(SELECT tbl_IRS.Details FROM tbl_IRS " & _
"WHERE (((tbl_IRS.IR_N umber)=[forms]![frm_IR_Entry]![IR_Number]));) &
[forms]![frm_memo_Update]![xt_Addition] " & _
"WHERE (((tbl_IRS.IR_N umber)=[forms]![frm_IR_Entry]![IR_Number]));"

DoCmd.RunSQL strSQL

UpdateMemoExit:
Exit Sub

UpdateMemoError :
Debug.Print "Error Description: " & Err.Description & vbCrLf & _
"Error Number: " & Err.Number
Resume UpdateMemoExit
but recieve the following error:

Error Description: Invalid Memo, OLE, or Hyperlink Object in subquery
'tbl_IRS.Detail s'.
Error Number: 3342

The help file says "
A subquery cannot return a Memo or OLE Object, and it cannot be compared to
a Memo or OLE Object in an expression." but I can't think of another way to
do this :o(
Am I barking up the wrong tree in the way I am trying to do this or is it
simply my syntax is incorrect?

TIA,

Mark
May 10 '06 #1
4 7250
"Mark Reed" <ma*********@nt lworld.com> wrote in message
news:XB******** **********@news fe2-gui.ntli.net...
Hi All,
here is what I am trying to achieve. I have a memo field on a form
which users will need to add to as and when. I do not want them to be able
to edit information which already exists within this field.


Hi Mark, this is how I do it (you'll have to rename objects as necessary and
I have three remarks memo fields to handle which I pass the names to in the
call's OpenArgs):

In your command button's Click event in your 'append' form:

If MsgBox("Are you sure?", vbYesNo, gcApplication) = vbNo Then Exit Sub

Dim strUser As String
strUser = libUserName

Dim db As DAO.Database, rs As DAO.Recordset, strSQL As String, strCriteria
As String, strFieldName As String
Set db = CurrentDb
strSQL = "Select * from qryRemarks;"
strFieldName = Me.OpenArgs
strCriteria = "[IssueNo] = " & Forms(gcFrmMain )!txtIssueNo '**This is the
record's unique ID **

Set rs = db.OpenRecordse t(strSQL)
With rs
.FindFirst strCriteria
.Edit
If IsNull(rs(strFi eldName)) Then
rs(strFieldName ) = "(" & strUser & ": " & Me.txtAppend & ")"
Else
rs(strFieldName ) = rs(strFieldName ) & " (" & strUser & ": " &
Me.txtAppend & ")"
End If
.Update
End With
rs.Close
Set rs = Nothing

*** END CODE ***

HTH - Keith.
www.keithwilby.com
May 10 '06 #2
On Wed, 10 May 2006 07:27:51 GMT, Mark Reed wrote:
Hi All,
here is what I am trying to achieve. I have a memo field on a form which
users will need to add to as and when. I do not want them to be able to edit
information which already exists within this field.

My idea was to have the memo field locked on the form to stop edits.
Place a command button by the memo field which opens an unbound form with a
single text box.
The user enters their update into the unbound form and upon closing it, the
text they entered will be added to whatever information already exists
within the memo field.

I have tried running the following code upon click a command button on the
unbound form:

On Error GoTo UpdateMemoError
Dim strSQL As String

strSQL = "UPDATE tbl_IRS SET tbl_IRS.Details = " & _
"(SELECT tbl_IRS.Details FROM tbl_IRS " & _
"WHERE (((tbl_IRS.IR_N umber)=[forms]![frm_IR_Entry]![IR_Number]));) &
[forms]![frm_memo_Update]![xt_Addition] " & _
"WHERE (((tbl_IRS.IR_N umber)=[forms]![frm_IR_Entry]![IR_Number]));"

DoCmd.RunSQL strSQL

UpdateMemoExit:
Exit Sub

UpdateMemoError :
Debug.Print "Error Description: " & Err.Description & vbCrLf & _
"Error Number: " & Err.Number
Resume UpdateMemoExit

but recieve the following error:

Error Description: Invalid Memo, OLE, or Hyperlink Object in subquery
'tbl_IRS.Detail s'.
Error Number: 3342

The help file says "
A subquery cannot return a Memo or OLE Object, and it cannot be compared to
a Memo or OLE Object in an expression." but I can't think of another way to
do this :o(

Am I barking up the wrong tree in the way I am trying to do this or is it
simply my syntax is incorrect?

TIA,

Mark


I would do it this way.
No SQL needed.

1) Set the Memo control's Locked property to Yes.

2) Add an unbound Text control to your existing form.
Size it as large as you wish.
You can place it on top of any existing controls on this form.
Set it's Visible property to No.
Name this control "AddToMemo"

Code it's AfterUpdate event:
Me![YourMemo] = Me![YourMemo] & " " & Me![AddToMemo]
Me![AddToMemo] = Null
Me![AnyOtherControl].SetFocus
Me![AddToMemo].Visible = False
=========

Code your command button click event:
Me![AddToMemo].Visible = True
Me![AddToMemo].SetFocus
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
May 10 '06 #3
Thank you both for your suggestions. I went with Keith's suggestion in the
end although I can see both would work.

Thanks again for your time. Very much appreciated,

Mark
"Keith Wilby" <he**@there.com > wrote in message
news:44******** **@glkas0286.gr eenlnk.net...
"Mark Reed" <ma*********@nt lworld.com> wrote in message
news:XB******** **********@news fe2-gui.ntli.net...
Hi All,
here is what I am trying to achieve. I have a memo field on a form
which users will need to add to as and when. I do not want them to be
able to edit information which already exists within this field.


Hi Mark, this is how I do it (you'll have to rename objects as necessary
and I have three remarks memo fields to handle which I pass the names to
in the call's OpenArgs):

In your command button's Click event in your 'append' form:

If MsgBox("Are you sure?", vbYesNo, gcApplication) = vbNo Then Exit Sub

Dim strUser As String
strUser = libUserName

Dim db As DAO.Database, rs As DAO.Recordset, strSQL As String, strCriteria
As String, strFieldName As String
Set db = CurrentDb
strSQL = "Select * from qryRemarks;"
strFieldName = Me.OpenArgs
strCriteria = "[IssueNo] = " & Forms(gcFrmMain )!txtIssueNo '**This is the
record's unique ID **

Set rs = db.OpenRecordse t(strSQL)
With rs
.FindFirst strCriteria
.Edit
If IsNull(rs(strFi eldName)) Then
rs(strFieldName ) = "(" & strUser & ": " & Me.txtAppend & ")"
Else
rs(strFieldName ) = rs(strFieldName ) & " (" & strUser & ": " &
Me.txtAppend & ")"
End If
.Update
End With
rs.Close
Set rs = Nothing

*** END CODE ***

HTH - Keith.
www.keithwilby.com

May 10 '06 #4
fredg <fg******@examp le.invalid> wrote in
news:ow******** *************** ******@40tude.n et:
On Wed, 10 May 2006 07:27:51 GMT, Mark Reed wrote:
Hi All,
here is what I am trying to achieve. I have a memo field
on a form which
users will need to add to as and when. I do not want them to
be able to edit information which already exists within this
field.

My idea was to have the memo field locked on the form to stop
edits. Place a command button by the memo field which opens
an unbound form with a single text box.
The user enters their update into the unbound form and upon
closing it, the text they entered will be added to whatever
information already exists within the memo field.

I have tried running the following code upon click a command
button on the unbound form:
[ code and error messages snipped ]
Am I barking up the wrong tree in the way I am trying to do
this or is it simply my syntax is incorrect?

TIA,

Mark


I would do it this way.
No SQL needed.

1) Set the Memo control's Locked property to Yes.

2) Add an unbound Text control to your existing form.
Size it as large as you wish.
You can place it on top of any existing controls on this form.
Set it's Visible property to No.
Name this control "AddToMemo"

Code it's AfterUpdate event:
Me![YourMemo] = Me![YourMemo] & " " & Me![AddToMemo]
Me![AddToMemo] = Null
Me![AnyOtherControl].SetFocus
Me![AddToMemo].Visible = False
=========

Code your command button click event:
Me![AddToMemo].Visible = True
Me![AddToMemo].SetFocus


You can modify fred's concept to use your unbound modal form to
write the data back to the mainform control.

In the unbound form's UpdateMemo event, instead of the
Me![YourMemo] reference, just use the full reference to the form
Forms![YourMainForm]![YourMemo] = _
Forms![YourMainForm]![YourMemo] _
& vbNewline & vbnewline & now() &": " _
&Me!addtoMem o
me!close
--
Bob Quintal

PA is y I've altered my email address.
May 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10484
by: Shyguy | last post by:
I want to create two buttons on a form. One would allow the user to Copy the contents of the current records memo field, the other would allow them to print. I set up a report based on the memo field, and it works. But, it seems wrong since I had to create a huge text box to accommodate memo fields with a lot of text. Thanks for any help, ShyGuy
3
10220
by: GorDon | last post by:
Hi, I have a report based on a query. The query grabs a memo field from my main table, yet when I display the memo field in the report it truncates the memo field (the field needs to hold more than 255 characters). The table holds all the memo text, but the query seems to truncate the memo field to 255 chars? This seems like there should be a relatively easy fix, but I can't seem to find it.
2
5241
by: Bob Dydd | last post by:
Hi Everybody I have a Listbox that has a Memo field attached to it's 2nd column which on double click copies the memo field to another Memo Field. Forms!! = ListClassification.Column(1) My problem is that the receiving Memo Field Truncates at 255 characters
2
5756
by: Kevin | last post by:
Thanks for the very quick response posting that I can use a memo datatype to store large amounts of text. I understand that I can turn on "Can Grow" for a memo type, but is there either a property or VB code that will allow the text box to expand vertically as the user adds lines, so that it isn't necessary to use the vertical scroll bar to view text above/below the displayed window? I'm looking for a sort of dynamic autosize.
1
3066
by: alexsg | last post by:
A little while ago Ron P kindly responded to my inquiry on how to copy the first line of memo field into a text field, using a query: left(,instr(1,,vbCrLf)-1) This is great, but I would like to do this on a form, so that the person entering the memo can use a button to paste the 1st line to a title (text) field. I'm having trouble setting up the code to do this. I'd also appreciate some ideas on how to get the 2nd and 3rd lines...
9
5744
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo field is printed within the detailed area. The problem is, the apllication is not setup properly, thus the users are entering data within the memo field as: location1 1/1/2005 1/1/2006
2
3393
by: Roger | last post by:
I've got two tables in sql2005 which have an 'ntext' field when I linked the first table in access97 last week using an odbc data source the access-field type was 'memo' when I link the 2nd table today, it is linked as a text(255) field, ditto for the first table if I link it today if I link the 2nd table using access2003 (and the same odbc data source) it is linked as a memo field
10
3069
by: ARC | last post by:
This is mainly a speed question. In this example: I have a QuotesHdr table that has a few memo fields. If these memo fields are used extensively by some users, and if their are a large number of records in QuotesHdr, should I break out the memo fields into a separate table? The thinking here is that, for Quotes selection dropdowns that display all entries in QuotesHdr for selection, I would think that the entire record comes down over...
11
3744
tdw
by: tdw | last post by:
Hi all, I have tried a few different methods to accomplish this, but with no luck. I will post the code for the latest attempt at the end of this post. I work at a land surveying company. This database is for tracking survey orders. One of the fields is for entering the Subdivision that the parcel of land is in. That field on the New Orders entry form is called "SUB_NAME". On that form it is a combo box that uses a seperate table called...
0
9879
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9725
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10640
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10705
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9477
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7877
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5714
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4111
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.