Working with medical/legal records, I've used this hack for a number of years. A second, unbound textbox (TempDataBox) is used to enter the data into. This textbox is originally hidden, and when the command button (IndirectDataInput) is clicked, it appears. Data is entered, and when the command button (now captioned “Commit Data”) is clicked again, the entered data is added to the memo field.
Now, in this example, there are two memo fields, but only one is bound, since the other memo field is simply a temporary holding area. The memo field is also locked so that all data entry has to be done thru the temporary textbox.
TempDataBox is unbound, and in the Property Box its Visible Property is set originally set to No. I place mine side by side with CommentsField so the user can refer to what's currently in the CommentsField section while entering new notes.
CommentsField is bound to the underlying table/query, and its Locked Property is set to Yes.
Place a command button on the form. Name it
IndirectDataInput and in the Properties Box set its Caption to “Add New Data.”
Now use this code:
- Private Sub IndirectDataInput_Click()
-
If IndirectDataInput.Caption = "Add New Data" Then
-
TempDataBox.Visible = True
-
TempDataBox.SetFocus
-
IndirectDataInput.Caption = "Commit Data"
-
Else
-
IndirectDataInput.Caption = "Add New Data"
-
If IsNull(Me.CommentsField) Then
-
If Len(Me.TempDataBox) > 0 Then
-
Me.CommentsField = Me.TempDataBox
-
Me.TempDataBox = ""
-
TempDataBox.Visible = False
-
Else
-
TempDataBox.Visible = False
-
End If
-
Else
-
If Len(Me.TempDataBox) > 0 Then
-
Me.CommentsField = Me.CommentsField & vbNewLine & Me.TempDataBox
-
Me.TempDataBox = ""
-
TempDataBox.Visible = False
-
Else
-
TempDataBox.Visible = False
-
End If
-
-
End If
-
End If
-
End Sub
Replace
CommentsField with the actual name of your textbox and keep the rest of the control names as given.
Welcome to
Bytes!
Linq
;0)>