This hack doesn't use a popup form but rather a second textbox to enter the data into. This textbox is originally hidden, and when the command button (
Add Data)is clicked, it appears. Data is entered, and when the command button (now named
Input) is clicked again, a timestamp plus 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.
InputMemoField is unbound, and in the
Property Box its
Visible Property is set originally set to to
No. I place mine side by side with
YourMemoField so the user can refer to what's currently in the
YourMemoField section while entering new notes.
YourMemoField is bound to the underlying table/query, and its
Locked Property is set to
Yes.
Place a command button on the form. Name it
cmdInputData and in the
Properties Box set its
Caption to
Input.
Now use this code:
-
Private Sub cmdInputData_Click()
-
If cmdInputData.Caption = "Input" Then
-
InputMemoField.Visible = True
-
InputMemoField.SetFocus
-
cmdInputData.Caption = "Add Data"
-
Else
-
cmdInputData.Caption = "Input"
-
If IsNull(Me.YourMemoField) Then
-
If Len(Me.InputMemoField) > 0 Then
-
Me.YourMemoField = Now() & " " & Me.InputMemoField
-
Me.InputMemoField = ""
-
InputMemoField.Visible = False
-
Else
-
InputMemoField.Visible = False
-
End If
-
Else
-
If Len(Me.InputMemoField) > 0 Then
-
Me.YourMemoField = Me.YourMemoField & vbNewLine & Now() & " " & Me.InputMemoField
-
Me.InputMemoField = ""
-
InputMemoField.Visible = False
-
Else
-
InputMemoField.Visible = False
-
End If
-
-
End If
-
End If
-
End Sub
Welcome to
Bytes
Linq
;0)>!