By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,649 Members | 696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,649 IT Pros & Developers. It's quick & easy.

Pop-up form to add comments

P: 10
Iím sure that this has already been answered but I canít seem to find the answer.

What Iím trying to do is when the user clicks on a button on the main form to add comments to a memo field, a pop-up form appears that allows them to add the comments, after they add comments on the pop-up form, the entry is time/date stamped and added to the memo field on the main form.
Any code would be appreciated.
Thanks.
Sep 18 '08 #1
Share this Question
Share on Google+
3 Replies


missinglinq
Expert 2.5K+
P: 3,532
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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdInputData_Click()        
  2. If cmdInputData.Caption = "Input" Then
  3.    InputMemoField.Visible = True
  4.    InputMemoField.SetFocus
  5.    cmdInputData.Caption = "Add Data"
  6. Else
  7.    cmdInputData.Caption = "Input"
  8.    If IsNull(Me.YourMemoField) Then
  9.       If Len(Me.InputMemoField) > 0 Then
  10.         Me.YourMemoField = Now() & "  " & Me.InputMemoField
  11.         Me.InputMemoField = ""
  12.         InputMemoField.Visible = False
  13.       Else
  14.         InputMemoField.Visible = False
  15.       End If
  16.     Else
  17.       If Len(Me.InputMemoField) > 0 Then
  18.        Me.YourMemoField = Me.YourMemoField & vbNewLine & Now() & "  " & Me.InputMemoField
  19.        Me.InputMemoField = ""
  20.        InputMemoField.Visible = False
  21.       Else
  22.        InputMemoField.Visible = False
  23.       End If
  24.  
  25.     End If
  26. End If
  27. End Sub
Welcome to Bytes

Linq ;0)>!
Sep 18 '08 #2

P: 10
Thank you this is exactly what I was looking for.
Sep 18 '08 #3

P: n/a
I can't get the above to work... I would really value a step by step guide, if you don't mind.
Thanks, in advance.
Will
Oct 14 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.