Set field value in new row

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."
 
K

Ken Snell

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
 
L

laura

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
 

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

Top