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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update current record only when I click on a field? 1

Status
Not open for further replies.

TommyTea

Programmer
Nov 7, 2002
43
US
How can I enter use the on click event in order to stamp the contents of a textbox into a field on a subform? The subform is displayed as a continuous form.
 
If the cursor location (absoluteposition) of the subform is on the record you want to update, you can use Fields collection of the recordset of the subform object.

Me.SubFormControl.Form.Recordset.Fields("FieldName") = "Text"
Me.SubFormControl.Form.Recordset.Fields("FieldName") = 2
Me.SubFormControl.Form.Recordset.Fields("FieldName") = #12/1/2005#
Me.SubFormControl.Form.Recordset.Fields("FieldName") = YourFunctionName()

Depends on the data type of the field you are working with as to the way the data must be handled in code.

If the cursor/abs. position of the recordset is not necessarily on the proper record, you can either move the cursor to the right record, or do an update to the recordset (via DAO or an Update Query) to ensure that you wrote to the right record, and then requery the subform object.

HTH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top