We help IT Professionals succeed at work.

How to keep a memo displayed

Jass Saini
Jass Saini asked
on
Hello,

I have code that will write to my Memo box if there is a value in BC1 and so on.  It will only display the text if I in a record that has BC1.  I need to keep displaying after I click off the record so the user know that they entered something into the memo box

Here is my code
Private Sub Remarks1_AfterUpdate()
 Dim rst As DAO.Recordset
   Dim strRemarks As String
   
    strRemarks = Me.Remarks1
    If strRemarks = "" Then Exit Sub
   
   Set rst = CurrentDb.OpenRecordset("Final_Table")
   'strRemarks = Me.Remarks1

   Do While Not rst.EOF
      rst.Edit
        If Nz(rst![BC1Chng1]) <> "" Then
         rst![Remarks1] = strRemarks
      Else
         rst![Remarks1] = Null
      End If
      rst.Update
      rst.MoveNext
   Loop
      

End Sub

Open in new window

Comment
Watch Question

Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014
Commented:
I need to keep displaying after I click off the record
Keep displaying what?

You can always store the stuff you want to display in a form-level variable, and then show that variable wherever needed.

'/ In the General Declarations section of your form, at the top
Private MyText As String

'/ Somewhere else in your code, perhaps in the AfterUpdate event of a Textbox:
MyText = Me.YourTextBox

'/ Now show it somewhere:
Msgbox "The value in the variable is " & MyText

Author

Commented:
On my form...if I click off the record the Remarks1 field doesn't show what I just typed.  I want it to continue to show even after I click off the record

MyText ..is a variable???
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
if I click off the record the Remarks1 field doesn't show what I just typed.
I assume the Remarks field is a bound textbox (that is, the textbox has a ControlSource)? If so, then it would show the value from the Remarks field for each RECORD.

If you "show" the value you type in one field in the others, then Access will update the other records. Is that what you're after?

Regardless, the method I suggested would work, assuming you always want to have the "latest" data typed into Remarks.

Yes, "MyText" is a variable, created in the General Declarations section of your form.

Author

Commented:
Thank You