Referencing the 'Phantom' Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to reference the "new record" row at the bottom of a form in
datasheet view and reset a value for one of its fields ?

I have a properly working procedure that resets the DefaultValue property
for a form's checkbox field in new records, but that checkbox field in the
blank "new record" row that existed at the time the procedure runs remains
unchanged. Need to change it, too, so that when a user uses the blank row to
add a new record, that checkbox's value is properly pre-set.
 
Jay said:
Is there a way to reference the "new record" row at the bottom of a form in
datasheet view and reset a value for one of its fields ?

I have a properly working procedure that resets the DefaultValue property
for a form's checkbox field in new records, but that checkbox field in the
blank "new record" row that existed at the time the procedure runs remains
unchanged. Need to change it, too, so that when a user uses the blank row to
add a new record, that checkbox's value is properly pre-set.


The DefaultValue property is applied to a new record on the
first keystroke in any bound control. I.e. changing the
DefaultValue has no effect on a new record that is dirty.

Your current code will work fine in every case except when
the current record is dirty and it is also a new record. In
this one case, you should either Undo the unsaved new record
or set the control's Value property inaddition to its
DafaultValue.

Me.chkbox.DefaultValue = True 'or False
If Me.NewRecord And Me.Dirty Then
Me.chkbox = True 'or False
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top