Set field value in new row

  • Thread starter Thread starter Jonathan Blitz
  • Start date Start date
J

Jonathan Blitz

I have fields in a table that do not appear on the form.
How do I set values for these fields so that they will be added correctly to
the database.
I know what values I want to put there.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
Set the Default Value of the field in the table's design view to the desired
value if the value will always be the same expression for each record.

If you want to set the value based on an entry in the form, include the
field in the form's recordsource, then use VBA code to set the value of the
field using the form's BeforeUpdate event:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.FieldName = "Value"
End Sub
 
If the form's recordsource is the table, the surely the field an be referred
to even if it is not on the form? What I have done in the past is to put the
field on the form and set the visible attribute to No, then I have been able
to assign a value to it.

Laura TD
 
Back
Top