Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Push Values for Comments Field 1

Status
Not open for further replies.

mtownbound

Technical User
Jan 28, 2002
293
US
I have a form that is used to enter data, but I need to have a field, that populates a child "Comments" table that I can use to capture user comments and later view all the comments for a given record.

 

If it is one to many you can create a table for user comments. It would have a foreign key that relates the comments back to the the main table. Then put a subform on your form and link it by the main tables ID to the child tables foreign key.
 
Thanks for the response. Have a 1:Many from the Records table to the Comments table, but for the subform, I just need a text field that users can enter comments and a submit button to push the comments to the Comments table.
 
You can format the subform in single record view. Size everything and play with the format. You can end up what looks like nothing but a text box comment field. Play with the scroll bars, record selectors, and navigation button format.

Depends on how you want this to work.
Do you want to be able navigate back to the old comments?
Do you want to still see the comment after you enter?
Do you just want to hit enter and see just an empty text box?

If you set the property of the subform to data entry, then the subform always opens at a new blank record. Then you will need a button on the main form to move to another new record which in turns saves the existing comment

Private Sub Command12_Click()
With Me.CommentsSubform
.Form.Dirty = False
.SetFocus
End With
DoCmd.GoToRecord acActiveDataObject, , acNewRec
End Sub

You can also have two subforms. One in multi record view to show the list of existing comments, and the other in single form view for adding a new comment.
 
When using a subform approach, you really are not "pushing" anything. Like any form if you move off of the new record to an old record or the next new record it is saved.

If you can do some coding this is a case where doing it unbound is a little easier. It is easier in that you do not have to play with all the formatting and events of the subform. You just add a textbox to the main form and the add button fires an insert query.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top