I have a form and would like with the push of a command button for data to be sent to a comments field based on data entered in a different field. (ex- if field 1 is not "ok" i want the comments field to say "field 1 is not ok") If there is something in the comments field already i dont want it to be replaced with the new data... i want it to be added to it. is this possible? thanks
Adding data to field
Collapse
X
-
Tags: None
-
The short answer to your question is yes, it is possible.
You will have to add the Click event to your command button. I'm going to assume a couple of things about your form, the fields on it, and the table you're using. Keep in mind that you'll need to change my assumptions to match your naming conventions in your database.
Code://Assumptions Command button name: cmdStatusCheck Field to check: txtStatus //This holds the value "Ok" or "Not Ok" - you called this Field1 Comment (text) box: txtComments
Code:Private Sub cmdStatusCheck_Click() If txtStatus <> "Ok" Then If txtComments = "" Then txtComments = "Field is not ok" Else txtComments = txtComments & " " & "Field is not ok" End If Else MsgBox "The field is okay and no comments will be added.", vbInformation + vbOKOnly, "Add Comments" End If End Sub
Comment